User Tools

Site Tools


tips:linux:vitricks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tips:linux:vitricks [2009/06/08 15:52]
erik created
tips:linux:vitricks [2009/06/08 15:53] (current)
erik
Line 1: Line 1:
 +====== Useful VI Tricks ======
  
 +Put this in your .vimrc:
 +
 +  map <F5> :s.^//.. <CR> :noh <CR>
 +  map <F6> :s.^.//. <CR> :noh <CR>
 +
 +Now you use a visual line select (''​shift-V''​) to select what you want to comment,
 +smack ''​F5''​ and it's done. ''​F6''​ uncomments.
 +
 +As a bonus, use these to change indents. Change indent to your preference for
 +indenting. I use 4 spaces. Use ''​\t''​ if you want a tab. Combined with ''​shift-V'',​ you
 +can move whole blocks left and right easily.
 +
 +  map <F7> :​s/​^indent//​ <CR> :noh <CR> gv
 +  map <F8> :​s/​^/​indent/​ <CR> :noh <CR> gv
tips/linux/vitricks.txt · Last modified: 2009/06/08 15:53 by erik