初步学了两招,先记到这里

还有个NERDtree和taglist,分别是类似与eclipse中左侧的Navigator和右侧的文件参数列表之类的功能

(1)javacomplete

不知道为什么,与下面的ctags一起用的话,貌似工程较多的话,会反应非常慢

功能:提示和自动补全功能,类似于eclipse中按“.”以后的效果

官网:http://www.vim.org/scripts/script.php?script_id=1785

安装方法摘自上面这个网页,英文并不难:),下载地址在这个页面最下面:

(首先最好确保环境变量JAVA_HOME,PATH,CLASSPATH正确)

 

  install details
1. Unzip javacomplete.zip to a directory of 'runtimepath', e.g.
$HOME/.vim (unix/linux), $VIM/vimfiles (windows).
> unzip javacomplete.zip -d ~/.vim

    To update Vim help tags, run vim and run command:
:helptags $HOME/.vim/doc
    or
:helptags $VIM/vimfiles/doc

NOTE: javacomplete.vim, java_parser.vim and Reflection.java should be in one
autoload directory of 'runtimepath'.
javacomplete.txt should be in one doc directory of 'runtimepath'.

2. Set 'omnifunc' option. e.g.
        :setlocal omnifunc=javacomplete#Complete
  Or, use autocmd:
        :" Only do this part when compiled with support for autocommands.
        :if has("autocmd")
        :  autocmd Filetype java setlocal omnifunc=javacomplete#Complete
        :endif
  You can add this command to your .vimrc or _vimrc.

3. Set 'completefunc' option to show parameters information IF YOU LIKE. e.g.
:setlocal completefunc=javacomplete#CompleteParamsInfo
You can map as follows for better display:
:inoremap
:inoremap

4. Reflection.java will be automatcally compiled and placed to $HOME when you
use first time. Assure that Reflection.java is in the same directory with
javacomplete.vim to be searched in autoload subdirectory of &rtp.
If no Reflection.class is generated, check that you have the write permission
in $HOME directory.
If a previous Reflection.java is not compatible with the new version
javacomplete.vim, please compile Reflection.java manually.

 

(2)ctags

功能:可以在代码间跳转,类似于在IDE中按住Ctrl点击类跳转

官网http://ctags.sourceforge.net/

【1】安装ctags:sudo apt-get install exuberant-ctags

【2】使用ctags生成链接文件:

ctags -f [输出目录] -R  [需链接的文件所在目录的列表]

比如:

ctags -f ~/.tags -R  $JAVA_HOME/src ~/workspace/

这句命令的结果是,把我机器上的jdk和我的所有工程都链接上,这样有引用的地方就可以互相跳转了

【3】然后在/etc/vim/vimrc中加入

set tags=~/.tags

也就是说,每次启动vim时都设置tags参数为~/.tags

【4】打开一个java文件,现在就可以跳来挑去的玩了~~

按Ctrl+]跳入,按Ctrl+o跳回

其他资料:

Exuberant Ctags中文手册

http://easwy.com/blog/archives/exuberant-ctags-chinese-manual/