index edit log

commenting text

Most programming languages have special characters such as

# PHP, cmake, (endless more langugaes)
// C/C++, (endless more)
-- SQL

or multiline comments
{- Haskell -}
/* C++ C etc */

How to remove comments ?

drop # at the beginning: (jj representing any up/down movement):


or by regex:


How to add comments ?

add # at the beginning: (jj representing any up/down movement)


or by regex:


VimL special case

You can use "finish" make Vim ignore rest of the file. (Nice for keeping your own memories etc). You're missing /* .. */ ? try if 0 ... endif


There are many plugins. One of the most simple yet powerful ones is vim-addon-commenting. Its Readme references alternative solutions.