开发者

vim java omnicomplete

开发者 https://www.devze.com 2023-03-06 10:27 出处:网络
I\'m doing my best to follow the directions for install here: http://vim.sourceforge.net/scripts/script.php?script_id=1785, but I can\'t get it working and it seems sort of vague.

I'm doing my best to follow the directions for install here: http://vim.sourceforge.net/scripts/script.php?script_id=1785, but I can't get it working and it seems sort of vague.

Here's what I've done.

  • I verified that I've got vim 7 or 开发者_如何转开发higher.
  • I created a $HOME/.vim directory
  • I unzipped the latest into $HOME/.vim
  • I added the following two lines to .vimrc:

:setlocal omnifunc=javacomplete#Complete
:setlocal completefunc=javacomplete#CompleteParamsInfo

From there I'm not sure what I'm supposed to do to get it working. Ideas?


The :setlocal command set only the value for the current buffer and it makes no difference inside .vimrc. Instead, you should tell vim to set the value for every file of type java. This is how it is done:

if has("autocmd")
  autocmd Filetype java setlocal omnifunc=javacomplete#Complete
  autocmd Filetype java setlocal completefunc=javacomplete#CompleteParamsInfo
endif

Replace the commands in your .vimrc with the lines above and reload it (you can run :source ~/.vimrc for that).

Notice that you need autocmd for that (you must observe the value 1 when running :echo has("autocmd") inside vim).

0

精彩评论

暂无评论...
验证码 换一张
取 消