Tuesday, February 12, 2013

Vim 7: Turning auto completion on

Omni completion isn't automatically turned on for Vim 7, and it's super useful if you code in HTML, CSS, Javascript, XML, Python etc.

In your vimrc you can add following to turn completion on:

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 ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType c set omnifunc=ccomplete#Complete

You complete things with CTRL-X O.

No comments:

Post a Comment