Method 1:
Vim Visual Mode
Ctrl-v jjjjjj shift-i # Ctrl-[
Method 2:
Ctrl-v jjjjjj shift-i # ESC
Method 3 (GOOD):
Put following lines in your ~/.vimrc
map ,c I#
In vim, press ctrl-v to switch to block visual mode, then press ,c to comment.
To uncomment, press ctrl-v jjjjjjx (cut).
Note: this works in visual mode as well.
Method 4:
Put these lines in your ~/.vimrc
map ,c :s/^/#/
map ,u :s/^#//
Note: this works in visual mode as well.
Method 5:
Use this plugin: comments.vim
No comments:
Post a Comment