Ⅰ. 插件描述
Javacomplete is a plugin for vim for java completion.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'adragomir/javacomplete-come-back-be-here'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'adragomir/javacomplete-come-back-be-here'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'adragomir/javacomplete-come-back-be-here'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/adragomir/javacomplete
Ⅳ. 文档说明
Java omni-completion for Vim 7.x
Starting point of the projec is:
- https://github.com/VictorDenisov/javacomplete, by Victor Denisov, which in turn is started by
- http://www.vim.org/scripts/script.php?script_id=1785, created by Mr. Fang Cheng.
I do not take credit for any of the work, I have contacted the authors about these modifications.
Modifications
javacomplete.vim is a vim plugin that uses
- a java parser written in plain vim for completion in source code files.
- a java reflection class written in java for completion from jars / .class files
I have made the following changes:
- added javacomplete#GoToDefinition; should open the definition of any varible inside the file, or outside
- changed the Reflection.java mechanism with a new tool, that
** introspects and saves caches with parsed source / introspection data for both source and binary classes - the vim script parser is kept for the current file.
Dependencies
- Sun JDK
- nailgun client installed
Usage
Add bindings to your vimrc
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
autocmd Filetype java map <leader>b :call javacomplete#GoToDefinition()<CR>
Create a vim script file containing the list of classes, jars and source paths in your project:
call javacomplete#AddClassPath('/home/user/.m2/repository/asm/asm/3.1/asm-3.1.jar')
call javacomplete#AddClassPath('/path/to/class/files')
call javacomplete#AddSourcePath('/path/to/source')
...
Source the file, edit something in your project. C-x C-o gets you omni completion, <leader>b goes to definition