How to Change the Leader Key in Vim

I have to look this up every time I need to do it, so I’m posting this for myself. (Of course, it would be better to keep track of my .vimrc so I wouldn’t have to do it from scratch!)

Add to your .vimrc:

let mapleader = <space> (or whatever key you want)

Installing YouCompleteMe Plugin for Vim in Ubuntu


The YouCompleteMe plugin (YCM) provides “Intellisense-like” features within Vim. Setting it up requires several steps:

  1. Install the plugin using any Vim plugin manager. For example, if you use Vundle, you would add to your .vimrc:
    • Plugin ‘Valloric/YouCompleteMe’
  2. Install development tools:
    • sudo apt install build-essential cmake python3-dev
  3. Install Ubuntu packages on which YCM depends for the programming languages you plan on using:
    1. For C and C++ support: sudo apt install clang-8 libclang1-8 clang-tools-8
    2. For C# support: sudo apt install mono-complete
    3. For JavaScript and TypeScript: sudo apt install nodejs npm
    4. For others, see the YCM documentation at
  4. Run the YCM script with flags appropriate to the above languages:
    • For C and C++: --clang-completer
    • For C#: –cs-completer
    • –ts-completer
    • For example, if you want support for all three of the above language groups, you would do:
      • cd ~/.vim/bundle/YouCompleteMe
      • python3 ./ –clang-completer –cs-completer –ts-completer