I found the NERD comment plugin for vim, but I don’t understand the documentation. Say I want to comment some code in c/c++ e.g.
code line 1
code line 2
becomes
/*
code line 1
code line 2
*/
I have seen other threads on this, but to be honest I don’t know what <leader> is in the NERD commenter documentation. When I try the accepted answer in this other thread, I end up executing the change command on the selected lines. What is <leader> and, step-by-step, how do I go about commenting lines with /* */?
Try the built-in help, it’s excellent.
:help <Leader>brings you to the relevant documentation. It’s just an identifier for an unused key (by default \, but many change it to ,) that is recommended for starting any custom mappings.NERD_commenter defines the
<Leader>ccmapping, so you’d press (one after the other): \ C C.