Ⅰ. 插件描述
add import-statements automatically when editing java code.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'richox/vim-javacompleteex'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'richox/vim-javacompleteex'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'richox/vim-javacompleteex'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/richox/vim-javacompleteex
Ⅳ. 文档说明
vim-javacomplete_ex
improved vim-javacomplete, with the following features:
- complete a class name.
- add 'import' statement for a given class.
this vim plugin is tested under linux. windows or other systems are currently not supported.
Install
you should first have vim-javacomplete installed, which this plugin is depending on.
simply merge vim-javacomplete_ex/plugin into your .vim/plugin directory.
putting the whole vim-javacomplete_ex directory into .vim/bundle is also OK, if you have vim-pathogen installed.
Usage
better java completion:
besides vim-javacomplete's completion, vim-javacomplete_ex supports completing classnames:
example: ClassNa| => shows all class names under $CLASSPATH prefixed with "ClassNa".

add import statement:
- move cursor on your classname.
- execute
:JavaCompleteExAddImportcommand under normal mode, you can map:JavaCompleteExAddImport<CR>to any key you want:).
Configuration
set omnifunc=javacomplete_ex#Complete and use <C-x><C-o> for completion.
vim-javacomplete_ex has currently the following configurations:
let g:JavaCompleteEx_JavaHome # $JAVA_HOME
let g:JavaCompleteEx_ClassPath # $CLASSPATH
normally you don't have to modify them, but you can also edit them by hand, for example you can change a different classpath when editing java code.
update log
20131218 -- rename reposity to vim-javacompleteex.
20131212 -- initial update.