I Can't work with NERDCommenter

vim

Solution

Problem

On many non-English keyboards, the backslash `\` is only accessible through a AltGr key combination. This makes the default setting of the `<Leader>` character rather impractical for these users. Moreover, `<Leader>` key combinations are subject to a default 1000ms time-out. This can be observed by the disappearance of the `<Leader>` key at the right edge of the command line. So, non-English keyboard users need to be real quick typists for \cc to work. Failure to do so, results in an undesired `cc` line change.

Here is an example of a German keyboard layout with the backslash-bearing key on the top row, third from right:

Solution

Non-English keyboard users are advised to change the `<Leader>` key from the `\` character to the more accessible , key. Vim beginners should also consider a slightly longer 1500ms time-out. Here is what needs to be added to `~/.vimrc`

let mapleader=","
set timeout timeoutlen=1500

One final caveat; these changes only take effect after completely exiting Vim. Resourcing with `:source $MYVIMRC` will not work!

Now, one can use ,cc for commenting with NERD Commenter.

Problem

I installed NerdCommenter like how it should be installed. And I read the help files. So, for commenting a line I need to do `<leader>c$`. I also read that the leader key is `\` by default. But it didn't work for me. I never used the leader key so I think I am doing something wrong. Can anybody help me for using the basic commenting and uncommenting selected lines using nerdcommenter?

Original source