kb for j2ee development on vim:

115 views
Skip to first unread message

B V Raghav

unread,
Apr 15, 2011, 12:05:29 AM4/15/11
to v...@vim.org
Hi

Please help or point out a knowledge base/wiki/help, anything if
possible to get started with the j2ee development on vim.

What I want to understand is, what does an IDE exactly do, when they say
"create a project", "add a Resource Class" etc, and how to do that using
vim.

---------------
Background
---------------

I had started using vim as a text editor, then promoted myself to a php
programmer on vim, and now, as I am learning j2ee, I believe, continuing
my stint here will be great.

Most of the knowledge bases for j2ee development, on the internet, start
with an IDE, and I personally feel, it is too much pain to focus on
learning the IDE itself while I want to learn programming.

Thanks for your guidance
r

------------
bvraghav
ma...@bvraghav.com

Väinö Leppänen

unread,
Apr 16, 2011, 2:06:29 PM4/16/11
to vim...@googlegroups.com
Unfortunately the IDEs (NetBeans, Eclipse) do a lot in JavaEE development.
They setup the directory structure, make sure your code's good, package war- and
jar-files and deploy war-files to glassfish ...

I've personally been using NetBeans and doing the hard coding with Vim. In my
opinion you'd have to be a wizard to develop JavaEE with only Vim.


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Taylor Hedberg

unread,
Apr 16, 2011, 6:34:55 PM4/16/11
to vim...@googlegroups.com
I do a lot of Java work at my day job and I use Vim as my primary
editor. However, I do it in conjunction with Eclipse. I thought I'd
share my experience here as it may be useful to you or others.

There are a couple of plugins for Eclipse that emulate vi-style editing
in Eclipse's built-in editor, but I was never really satisfied with
those. They force you to use whatever subset of Vim's commands the
plugin author decided to implement, and I was constantly running into
situations where I wanted to do something the "Vim way", but the plugin
wasn't sophisticated enough to support it.

There's also one plugin that embeds GVim within your Eclipse window, but
the integration seemed really flaky, and Eclipse seemed to crash or hang
even more often that it already does while I was running it.

Then there's Eclim <http://eclim.org/>, which allows you to run Eclipse
as a server and embed a lot of Eclipse's functionality inside of a Vim
session. Personally, though, I really don't like Eclipse, and I didn't
want to get any Eclipse in my Vim. Eclipse is an unfortunate necessity
for a lot of Java development, but I wanted to keep its usage to a
minimum.

What I eventually settled on was actually rather simple: First, I
created a small shell script as follows (this is Unix-specific, of
course, so it won't work if you're on Windows):

#!/bin/bash

if [[ $# -eq 0 ]]; then
vim --servername ECLIPSE_SERVER "+set dir=~/tmp"
exit
fi

if [[ -n "$(vim --serverlist | grep ECLIPSE_SERVER)" ]]; then
vim --servername ECLIPSE_SERVER --remote "$1"
else
echo 'Vim server "ECLIPSE_SERVER" not running' >&2
exit 1
fi

This script is saved on my path as "vim_eclipse_launch". I can type that
filename on the command line to start a Vim session in server mode.
Then, in my Eclipse preferences, I add vim_eclipse_launch as an external
editor and associate various filetypes (*.java, *.jsp, *.xml,
*.properties, etc.) with that editor. That way, when I open a file from
within Eclipse, e.g. by clicking on the filename in the project
explorer, it pops up in my Vim window instead of in Eclipse's built-in
editor.

It helps to use this in conjunction with a tiling window manager like
xmonad or dwm, so you can have Vim and Eclipse easily positioned
side-by-side. I also use some popular Vim plugins like Taglist and
NERDTree to make it easier to manage large amounts of Java code within
Vim instead of having to jump back over to Eclipse for that sort of
thing. Over time, I've grown quite accustomed to working this way and I
think it's pretty much the best of both worlds. The only thing better
would be to eliminate Eclipse entirely, but that's really not feasible
with Java.

Anyway, this may not appeal to everyone, as you are still lacking
Eclipse's "intelligent" auto-completion when working this way, and there
are some other rough edges, such as the fact that Eclipse doesn't see
the edits you've made in the Vim session until you explicitly tell it to
refresh the file or project. But it works well enough for me, and it
makes me not hate working in Java so much anymore. A little Vim makes
anything better!

Druuu

unread,
May 13, 2015, 11:44:48 AM5/13/15
to vim...@googlegroups.com
Hi Taylor,
Like you I'm vim-fan, and u saved my life, thats the best satisfaction i could get vim+eclipse.

Thank You
Reply all
Reply to author
Forward
0 new messages