Auto-complete javascript syntax with Vim

很多人问js怎么自动补全,直接上文,以后就不需要再说了,其实很简单,vim目录autoload下自带js的 插件 ( javascriptcomplete.vim ) 没有请下载!

然后再.vimrc中加入:

autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS

然后就ok了.使用方法是 C-x o来显示自动补全,看下效果:

Auto-complete javascript syntax with Vim


PS:其实其它语言类似了,我放一段我的vimscript,你们相应修改即可.

filetype plugin indent on
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complete
autocmd FileType asp set omnifunc=aspcomplete#Complete
if has("autocmd") && exists("+omnifunc")
     autocmd Filetype *
   \ if &omnifunc == "" |
   \ setlocal omnifunc=syntaxcomplete#Complete |
   \ endif
endif
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1

..........................................................

Vim群(45045241)里 ,进群口令:

1:Vim 如何强制保存并退出;
2:h j k l 键有什么作用。 

回答才能进入,谢谢!

.........................................................



原文链接: http://blog.csdn.net/crazyjixiang/article/details/6677291

你可能感兴趣的:(Auto-complete javascript syntax with Vim)