Search

5/13/2008

autocmd FileType , iabbrev

sontek ( John M. Anderson ) » Python with a modular IDE (Vim)

Snippets

A great time saver with stanard IDE’s is code snippets, so you can type a few key strokes and get a lot of code out of it. An example of this would be a django model, instead of typing out the complete declaration you could type ‘mmo’ and have a skeleton of your model done for you. To do this in vim we grab the Snippets EMU plugin.

Check out a great screencast of snippetsEmu in action here

You can get my full setup here

~/.vimrc.html
這是好物阿,在.vimrc貼上下面數行,然後按下即可有code completion的功能。

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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 c set omnifunc=ccomplete#Complete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

iabbrev #l console.log
iabbrev #d console.dir
也可以利用iabbrev把常打錯的字修正過來
example: iabbrev consoel.log console.log

沒有留言: