[Ubuntu] ubuntu vim error when editing: option 'omnifunc' is not set

The reason for this error is that i am editing a html file, and it seems that gvim does not konw how to handle it.

 

At last i found this solution. Add the code to the /etc/vim/gvimrc

代码
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 html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#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
"let g:rubycomplete_rails = 1

 

 

posted @ 2011-01-11 22:09  DavidHHuan  阅读(1931)  评论(0编辑  收藏  举报