Vim Remade: Working on Java with all of Netbeans' features

The title sounds like a bold claim, given that the comparison sounds like one between apples and oranges. While vim will probably never incorporate some features that Netbeans as an IDE has, fundementally, both are text editors, and do share some commonalities that we can contrast and compare with.

I started using Netbeans because I needed a good RAD tool for building Swing GUIs. Matisse, the graphical GUI builder built-in with Netbeans, came to me as an impressive tool that allows for an easy and intuitive way of building graphical frontends.

It wasn’t just Matisse that impressed me. Netbeans had bucketloads of other editing features that weren’t available with vim, which left me feeling less satisfied than I originally was. But even as I toyed with the idea of dumping vim for Netbeans, trying to unlearn my keystrokes, getting used to context switches from fidgeting with menus and alternating between the mouse and keyboard again just wasn’t worth the trouble.

That had been my primary reason for writing the various Java Tips for Vim, which I hope becomes useful to other Java developers who code primarily in vim. To do a rehash on my current list of tips:

Intellisense (or Syntax Completion)

The first and foremost feature that I’d really liked in Netbeans is ‘intellisense’, or the auto-completion of syntax. It makes coding much a less tedious effort, saving up time and the trouble of having to constantly look up API calls via Javadoc.

Tabbing for Syntax Completion
As nice as it is, Netbeans' auto completion sometimes does not work as intended, either suggesting wrong stuff, or nothing at all. But what irks me most is that auto-suggestion can be intrusive and uncalled for at times.

However the existing keystroke sequences <C-X><C-U> for syntax completion in vim can be a bother sometimes, and easier way is to map the <tab> key to contextually determine whether you want syntax suggestion, or a tab itself.


Related to automatic syntax completion, is the ability to complete brackets, braces and curly braces, etc. While I haven’t completely figured out the way to foolproof auto-bracketing quotes and other quirks with my solution, this solution will probably be one of those ‘keep in view’ hacks that I’ll try to improve in the future.

API Lookup using ctags
Netbeans has a preview window that pops up relevant API information for Java, something that is lacking in vim. The closest alternative I know, is achieved by using ctags to look up API calls, saving a bit of a hassle by directing you to the right source file automatically.

Automatic compilation via Ant
Allows you to do a compilation with just the :make command. Of course you can bind it to the <F5> key and that would make it feel just as the same as an IDE.

Code Folding
Reduces visual clutter from your code, by folding them up according to methods, or other large blocks of code that makes semantic sense to you.

After these adjustments I’ve made, it is really starting to feel that vim is now customized sufficiently to have roughly the same amount of usability as Netbeans for Java specific development, so it will probably be while later before I revisit these issues again. Hopefully the tips will be as useful for you as I’ve found it!