Tuesday, September 26, 2006

VIM tips

when you want to add something to the head and tail of every line.

example: add " to head and tail .

hello world
welcome to black house
%s/.*/"\0"/g or %s/.*/"&"/g
"hello world "
"welcome to black house "


When paste some thing to vim, if there are some comment like // in the top lines , the vim will add // for the following lines. It's really boring. A good way is to use cat .

read !cat




No comments: