448

How do I add a comment in Vim's configuration files, like .vimrc?

Jonas Stein
  • 6,826
  • 7
  • 40
  • 72
alexchenco
  • 53,565
  • 76
  • 241
  • 413

4 Answers4

591

A double quote to the left of the text you want to comment.

Example: " this is how a comment looks like in ~/.vimrc

To be clear: Do not include a closing double quote. (See comment from Arslan Ali below.)

Wenfang Du
  • 8,804
  • 9
  • 59
  • 90
Myles
  • 20,860
  • 4
  • 28
  • 37
141
"This is a comment in vimrc. It does not have a closing quote 

Source: http://vim.wikia.com/wiki/Backing_up_and_commenting_vimrc

Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
user3670292
  • 1,519
  • 1
  • 9
  • 3
14

Same as above. Use double quote to start the comment and without the closing quote.

Also, you can have command followed by comment in file .vimrc just like below:

set nu  "display line number 
Randy Lam
  • 579
  • 5
  • 11
14

You can add comments in Vim's configuration file by either:

" brief description of the command    

or:

"" commented command

Taken from here

ZaydH
  • 658
  • 6
  • 22
Saurabh
  • 5,176
  • 4
  • 32
  • 46