Wednesday, August 27, 2008

Vim hints: java setup

The simple startup is to add these to your .vimrc file and run the ctags as described below to allow for indexing of your source code:

set sm
set ai

" run on command line for tags setup : 
" ctags -f ~/.tags -R workspace/.../src $JAVA_HOME/src
"
set tags=~/.tags
set complete=.,w,b,u,t,i

" Java stuff.
syntax on

let java_highlight_all=1
let java_highlight_functions="style"
let java_allow_cpp_keywords=1

Now you can navigate in your java source code file by placing the cursor on a classname and hitting CTRL-]. To jump back and forwards while browsing your code, use CTRL-O and CTRL-I.

You can also view your jump list by using the cmd interface, :jumps.

Vim version is 7.1.138