The following works fine for me, it will comment out the current line:
<Leader>cc
but according to the docs (https://github.com/scrooloose/nerdcommenter#usage) if I want to toggle comments I do:
<Leader>c
which deletes the current line for me.
Am I missing something?
A few regular Vim commands do not work with my setup on Windows. Ctrl + v and Ctrl + q are some of them. I later discovered the following methods worked to uncomment lines. The following approaches remove the # symbol and preserve indents. Move the cursor to the first comment (arrows or h, j, k, l ). Then apply one of the following techniques:
There is this life changing plugin by tpope called vim-commentary Install via Vundle (or Pathogen I guess). Type Commentary here :<,'>Commentary and press Enter. Boom. Your done bud. Could this have just been an edit of the Tim Pope answer by Jim Stewart? I mark the first and last lines (ma and mb), and then do :'a,'bs/^# //
Hit Ctrl + q in GVIM or Ctrl + v in VIM, then go down to select first character on the lines to comment out. Then press c, and add the comment character. Uncommenting works the same way, just type a space instead of the comment character. c deletes the first character as well.
If you want to remove all commented lines from a file, then you will have to remove the lines starting with ‘#’. Assume, you want to remove all lines that match/contain specific pattern – then the command is similar to the above one. For example:
This command is actually <Leader>c<space>
, not just <Leader>c
(see this issue; this is not properly displayed in the readme).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With