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

Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.

Introduction to Recursion and Backtracking

Sorting Algorithms

Introduction to C Programming Language

And More...

Speak Your Mind