Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use NERDComment plugin for Vim

I am new to Vim itself but I am trying to adopt this editor for my needs. I installed NERDComment plugin as described and have it listed in my :scriptnames. But I don't understand from description and this page how to use it.
I have filetype plugin on in VIM/_vimrc and when I do ,cc (as I understand default is ,) it happens to work as cc* - Delete [count] lines [into register x] and start insert |linewise|.*
Please give me basic 'step-by-step' guide on [count]<leader>cc |NERDComComment| for example. I am pretty sure I just don't understand some kind of Vim concept so sorry if this question is lame.

like image 519
arbulgazar Avatar asked Apr 08 '26 20:04

arbulgazar


1 Answers

Step by step

  • [count] => number of lines to be commented, can be ommited
  • <leader> => leader key, \ by default. Many people change it to ,.
  • cc => just cc

Visual mode

Instead of count you can go into visual mode with v or V, select the lines you want to comment and then use \cc

About leader key

To know which one is your leader key you can use :echo mapleader, if that gives you Undefined variable the mapleader will be the default ('\').

You can check :help leader in vim for more info.

like image 125
DavidEG Avatar answered Apr 11 '26 09:04

DavidEG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!