Custom keys with NERDComment plugin and reassigned leader?

I am trying to configure the NERDComment plugin in vim, but I have problems with the keys. I would like to set the basic switching functions (comment out the line if it is uncommented, uncomment it if it commented out) so that it is c. The problem is that I reassigned Leader as ,, which is the same key that NERD wants for all its hot keys. Does anyone know how to do this?

+3
source share
2 answers

Just call the NERDComment function in your mapping. For example, my mapping to comment out the current line:

inoremap ,c <C-o>:call NERDComment(0,"toggle")<C-m>

It describes how this vim file works.

i inoremap , .

noremap , .vimrc .

,c - , .

<C-o> , NERDComment.

:call NERDComment(0,"toggle") - NERDComment.

<C-m> - , .

+9

, , , - , , :

nnoremap ,c :call NERDComment(0,"toggle")<CR>
vnoremap ,c :call NERDComment(0,"toggle")<CR>
+3

Source: https://habr.com/ru/post/1740863/


All Articles