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):

  <c-v>jjd

or by regex:

  %s@^#@@

How to add comments ?

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

  <c-v>jjI#<esc>

or by regex:

  %s@^#@@

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

plugins

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