选项omnifunc未在vim中设置?

时间:2013-05-30 09:40:32

标签: vim

root@debian:/home/debian# echo  $PYTHONPATH
/usr/lib/python2.7/:

root@debian:/home/debian# ls /usr/share/vim/vim73/autoload/ 
adacomplete.vim  decada.vim htmlcomplete.vim    netrw.vim        pythoncomplete.vim  spellfile.vim       tohtml.vim       zip.vim
ada.vim      getscript.vim  javascriptcomplete.vim  paste.vim        rcomplete.vim   sqlcomplete.vim     vimball.vim
ccomplete.vim    gnat.vim   netrwFileHandlers.vim   phpcomplete.vim      README.txt      syntaxcomplete.vim  xml
csscomplete.vim  gzip.vim   netrwSettings.vim   python3complete.vim  rubycomplete.vim    tar.vim         xmlcomplete.vim

cat  /etc/vim/vimrc
runtime! debian.vim
set mouse=a     " Enable mouse usage (all modes)
set ts=4
set expandtab 
set shiftwidth=4 
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
set number
set textwidth=80
syntax enable 
filetype indent on
filetype plugin indent on
autocmd FileType python setlocal et sta sw=4 sts=4
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

当我编辑一个python文件,如attatchment,输入ctrl+x时,输出是 附件1: enter image description here

输入ctrl+oenter image description here

选项omnifunc未设置?哪个设置错误 我的vimrc还是在哪里?

2 个答案:

答案 0 :(得分:3)

尝试使用空设置而不使用插件:

vim --noplugin -u . yourfile.html

我使用空的.vimrc并没有插件来获取此错误。这意味着在Vim中没有设置'omnifunc'变量,通常由文件类型插件完成。

尝试:

:set filetype=html

或者python,或者其他什么,看看<C-X><C-O>是否有效。

另外,试试:

:set omnifunc

看看它是否设置为任何值。

答案 1 :(得分:0)

  1. 由于您有filetype plugin indent on,因此不需要所有omnifunc行。

  2. 您的自定义设置/etc/vim/vimrc中没有任何位置。您在/etc/vim/ 中所做的一切必须尽快恢复

    您设置的正确位置为~/.vimrc,插件的正确位置为~/.vim/

  3. 为了简短起见,如果你希望Vim正常工作,请正常做事。