vimcommentsconfiguration-files

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


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


Solution

  • 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.")