I am using vim The-NERD-Commenter
plugin along with vundle
. But I am not able to get the plugin to work.
I have my leader ley mapped to ,
. When I run the :scriptnames
command I see that ~\vimfiles\bundle\The-NERD-Commenter\plugin\NERD_commenter.vim
is listed in the output. I am also able to bring up help for NERDCommenter
using :help NERDCommenter
command which tells me that the plugin is installed correctly. But when I try to toggle a comment using <leader>c<space>
which translates in my case to ,c
it invokes the change command instead.
I have my .vimrc
file here https://gist.github.com/bAmrish/be1aac3aeb087925a3e5
Update:
It looks like if I remove the leader key mapping from my .vimrc
file then the plugin starts working with the default leader key \
.
Please let me know what am I doing wrong.
Thanks, Amrish
You are installing the plugin twice (lines 15, 29):
Plugin 'The-NERD-Commenter'
Plugin 'https://github.com/scrooloose/nerdcommenter.git'
From scanning the README, the scrooloose version doesn't seem to support the c shortcut, so it may be doing some blocking. Reread the documentations and choose one of the two. Post back if your problem isn't solved by one of those two actions.
UPDATE: Okay, digging deeper. The plugin's .vim code runs the following line:
let leader = exists('g:mapleader') ? g:mapleader : '\'
In your vim try running
:echo exists('g:mapleader')
:echo 'g:mapleader'
If the mapleader exists and spits back , as expected, then we need to look for unexpected/buggy code in the plugin. If it doesn't exist or isn't , as you expect, then we know what needs to be fixed.