Ⅰ. 插件描述
vim + jvm classpathⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'roboll/vim-cp'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'roboll/vim-cp'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'roboll/vim-cp'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/roboll/vim-cp
Ⅳ. 文档说明
# vim-cp
this plugin sets the classpath for jvm based projects using
maven, sbt - and eventually
gradle and leiningen.
classpaths are exported from the build tool and stored in dotfiles in the
codebase - called .vimcp. the classpath for a given buffer is discovered by
traversing up the filesystem until a .vimcp file is found.
inspiration & credit
license
MIT
commands
the :CP<...> commands are provided to update the classpath of the
nearest module, found based on conventions of the build tool.
classpath scopes
support for multiple classpaths (i.e. compile, test, etc.) is provided by
writing .vimcp files under `src/test/.vimcp, for example - buffers beneath
there will give presidence to the test classpath due to it's locality.
scopes are defined in the variable g:vimcp_scopes, as a dict {scope_name :
rel_path_to_vimcp/}.
exported data
b:vimcp contains the classpath scoped to a given buffer.
build tool detection
maven
the root is determined by traversing upward to the first directory containing
a pom.xml. this results in commands being run on submodules in multi module
projects.
dependencies are output using the following command. `mvn
dependency:build-classpath -Dmdep.outputFile={{outputfile}}
-DincludeScope={{scope}}`
sbt
the root is determined first by the presence of build.sbt. if none,
fallback to sbt for those using an sbt wrapper script and .scala build
definitions.
dependencies are output using the following command. `sbt "export
{{scope}}:full-classpath"`
output is:
{{modulename}}/{{scope}}:fullClasspath {{classpath}}
module name is parsed and a best effort search for a directory of that name is
- the first, if any, gets
.vimcpwritten in that directory. module names must reflect the name of the directory they are found in.
integrations
syntastic
if syntastic is loaded in vim, sets the syntastic java_javac checker classpath.
javacomplete
if javacomplete is loaded, sets the classpath for autocomplete.
TODO
- [] handle errors on classpath generation
- [] source path for javacomplete
- [] test goto definitions javacomplete
- [] test javadoc and source jar classpaths with javacomplete