javaimp – a vim plugin for Java

javaimp is a vim plugin that allows you to open a file from its import entry in a Java source file.

To set it up, ensure you have the source code available for the files you want to be able to open.

Determine the path to the source code for each different module you use.

Each path entry should point to the directory in which the source resides, ie, .com, .org etc.

Example entry to add to your ~.vimrc:


let $JAVASOURCEPATH="$SERVLET_HOME/src/share,$JAVA_HOME/src,$XML_HOME/src"
map H :call OpenJavaImport($JAVASOURCEPATH)<CR>

Then press H while on a import line and the file should open (assuming the source files and the path have been set up already).

The paths in $JAVASOURCEPATH should have the source packages directly

underneath each path. The script needs to be able to add the package to the

path element and open a file.

install details

Vim 6: Copy to ~/.vim/plugin or $VIM/plugin directory

Vim 5: Copy to $VIM and add “source $VIM/javaimp.vim” to your vimrc

Any problems, add a comment below or use the contact form.

Leave a Reply

Your email address will not be published. Required fields are marked *