Thursday, September 5, 2013

Vim Tip: Comment out multiple lines

ommenting out a bunch of lines without a vim plugin:
Select your lines with VISUAL BLOCK (CTRL-V), then press I to insert before all highlighted lines. Next type your comment character, # (for python, shell, etc). Last press ESC.
I forget not frequently used, but helpful VIM commands from time to time.
You can alternatively select your lines with VISUAL LINE (SHIFT-V), then type : s/^/#
This tells the selected lines that you wish to substitute the start of the line with the # char.

No comments:

Post a Comment