How do I automatically insert comment leaders while typing comments?

To automatically insert comment leaders while typing comments, add the ‘r’ and ‘o’ flags to the ‘formatoptions’ option.

    :set formatoptions+=ro

You may also want to add the ‘c’ flag to auto-wrap comments using the ‘textwidth’ option setting and the ‘q’ flag to format comments with the “gq” command:

    :set formatoptions=croq

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind