wyc
wyc

Reputation: 55263

How to comment in Vim's config files: ".vimrc"?

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

Upvotes: 484

Views: 197667

Answers (4)

Myles
Myles

Reputation: 21500

Put a double quote to the left of the text you want to comment:

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

(You don't need a closing quote.)

This comment syntax is documented at :help comment, part of docs on Ex command-lines, which begins:

'"' at the start of a line causes the whole line to be ignored.  '"'
after a command causes the rest of the line to be ignored.  This can be used
to add comments. ...

(Note, per :help vimrc, that "Each line in a vimrc file is executed as an Ex command line.")

Upvotes: 641

Randy Lam
Randy Lam

Reputation: 689

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 

Upvotes: 16

Saurabh
Saurabh

Reputation: 6920

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

" brief description of the command    

or:

"" commented command

Taken from here

Upvotes: 14

user3670292
user3670292

Reputation: 1579

"This is a comment in vimrc. It does not have a closing quote 

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

Upvotes: 147

Related Questions