Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Monday, May 26, 2008

Search and delete lines in vim

vim is great editor but one must remember some commands. Sometimes we want to delete line as per the search criteria. vim is capable of that also. To delete the lines as per search use

:g/editor choice/d

This will delete all the lines that have the word "editor choice". Offcourse we can use regular expression too.

:g/regex/d

Pretty simple g tells to do thing globally. / for pattern enclosing . d for deleting.

Enjoy vim :)

Friday, April 25, 2008

Giving power to vim - 2

vim one of powerful editor in linux. Here are few tips to make it more powerful

1. Setting auto completion
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete