At the moment, my commenting and un-commenting is done by two different strokes listed below:
nnoremap <leader>c 0<insert>//<Esc>
nnoremap <leader><leader>c :s;^\s*//<cr>
Which is tedious for me, can someone help me to write a mapping macro that <leader>c
stroke removes the comments, if there are any, or add one otherwise.
If the comments/uncomments will all be done by the single lovely <leader>c
, that would be a lot less pain in my ......
Thanks!
p.s.
If you intended to learn Vimrc, read the answer, try those cool solutions. However, here comes the better pain killer: NERD Commenter,