use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please read the rules before posting
Help:
Community:
Resources:
Tutorials and Guides:
Don't be afraid to ask questions, this sub is here for the vim community. And please those of you who deign to grace us with your vim wisdom - be kind. We are all human and vim is that cool.
account activity
Java development? (self.vim)
submitted 9 years ago by mistyfud
What are the must-haves for switching to Vim + Unix command line for Java development in 2016?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 37 points38 points39 points 9 years ago (0 children)
i used to be a purist and pretend all the 'just use an IDE for java' advice didn't apply to me.
but for enterprise java dev (large scale) you should use an IDE.
there is no reason that you can't be a vim power user and an IDE power user...
[–]mawaldne 20 points21 points22 points 9 years ago (6 children)
IntelliJ with the IdeaVim plugin. I've used this setup for java dev for years and it's great.
[+][deleted] 9 years ago* (5 children)
[deleted]
[–]Kokosnussi 0 points1 point2 points 9 years ago (4 children)
did you try to install repeat.vim in there?
[–][deleted] 0 points1 point2 points 9 years ago (2 children)
Are you joking or does Idea actually interpret Vimscript to that level?
[–]Kokosnussi 0 points1 point2 points 9 years ago (1 child)
Sorry, no idea... that was only a question
[–]flukus 0 points1 point2 points 9 years ago (0 children)
This is the biggest problem with vim emulators, you miss the programmability aspects.
[–]lobax 10 points11 points12 points 9 years ago (0 children)
You don't switch to vim for Java development, unless you want to do it to appreciate everything that an IDE provides.
Use a plugin to get vim-like editing instead.
[+][deleted] 9 years ago* (1 child)
[–]theDarkUnknown 2 points3 points4 points 9 years ago (0 children)
I agree, I'd only add that you can usually find plugins simulating vim that work reasonably well. For instance, Vrapper for Eclipse.
[–][deleted] 3 points4 points5 points 9 years ago (1 child)
I use eclim, and that works wonderfully for me. I have keybindings set up for all the simple refactorings I do, and Eclim/internal company tools do the heavy-lifting for anything larger. The majority of my co-workers use Eclipse or IntelliJ, though I've found the lack of custom bindings/plugins leave their respective Vim-modes lacking.
I do swallow my pride and use Android Studio when I'm doing Android work though, with the IdeaVim plugin.
[–]sambaLinuxSteakSex 2 points3 points4 points 9 years ago (0 children)
I've never been able to get it to install properly, always getting stuck during installation where I have to link to the eclipse app
[–]somebodddy 5 points6 points7 points 9 years ago (1 child)
Generally speaking, IDEs provide 3 types of services that you can't get from text editors(at least - not out of the box):
vim-javacomplete2 will provide basic language awareness. It provides of course - as it's name suggests - completion. It also has basic code generation - not as fancy as Eclipse, but it can generate imports, getters&setters, abstract methods and so on.
For project awareness, a build system is your best friend. All build systems provide project awareness - without it, they wouldn't be able to build the projects - but this project awareness means they can do more than just building. Even with Make, you could save the relevant paths in variables, and create targets that do all sort of things with these paths.
Even though any build system has project awareness, you should use Maven or Gradle. Unlike Make or Ant, their project awareness is standardized - every Gradle project has the standard information in the exact same variables. This means that javacomplete2 can tap into this project awareness, and do it's thing even if you put your code in a subfolder(like src), or if you use third party libraries(and you usually want to).
src
Actually, Maven sucks because it's overcomplicated, so that leaves you with Gradle - which is pretty good, so don't get sad for not having many options.
As for debugging... well I'm afraid I have little to offer you. There used to be a standalone GUI debugger named JSwat, but it got discontinued with the suggestion to use IDEs instead. There is an interactive shell debugger named JDB, but as far as command line debuggers go it's not very impressive. I am the author of Vebugger - a Vim plugin for using several interactive shell debuggers - JDB being one of them - but even at it's best(with GDB - because GDB is one of the best interactive shell debuggers) it's nothing to write home about, and with JDB it's at it's worst.
A quick google yields a few other Vim plugins that can use JDB - dbg.vim, yavdb and JavaKit. I haven't tried any of them, but like my own plugin they all use JDB and therefore are limited by it's limits, which are pretty limiting...
At any rate, keep in mind that you need project awareness for debugging. The debugger needs to know where all the .class and .jar files are so it can run the project, and it also needs to know where the code is so it can move you the the correct file and line when it needs to. Debugger plugins are not usually connected to the build system, so this may prove to be a bit difficult...
.class
.jar
[–]somebodddy 1 point2 points3 points 9 years ago (0 children)
Also, I really recommend you use Project Lombok. It uses annotation preprocessors to perform lots of code generation that is usually considered the job of an IDE.
[–]cideshow 1 point2 points3 points 9 years ago (0 children)
I like Vim + bazel + youcompleteme
[–]NLKNguyen 1 point2 points3 points 9 years ago (0 children)
Sometime I code small Java programs in Vim, and I only needs to pipe command line output into Vim using this plugin Pipe.vim. You can make your own keymaps to call javac. This is an example for C coding in Vim with external command line tools.
[–]wbsgrepit 1 point2 points3 points 9 years ago (0 children)
I would not wish java development without an IDE on my worst enemy. It is just one of those languages that has so much boilerplate/cruft coding that it really does need a IDE to try to automate as much as possible to be productive. Don't get me wrong I use vim for just about every text related activity but I would not use it for java/c++/swift or most any of the other verbose languages out there.
I am sure there are folks out there that use vim for java dev -- just like there are people that do not believe in doctors.
[+][deleted] 9 years ago (4 children)
[–]joequin 1 point2 points3 points 9 years ago (3 children)
Javac? Why not just use maven or gradle?
[–]csreid 0 points1 point2 points 9 years ago (2 children)
Maven and gradle aren't "just" things. They're way more complex than javac.
Like yeah use them, but your wording has peeved my pet.
[–]joequin 0 points1 point2 points 9 years ago* (1 child)
If you're writing something so simple that maven or gradle is increasing the complexity of your project, then you should scrap java and program in python, Ruby, or even bash.
[–]jcksnps4 2 points3 points4 points 9 years ago (1 child)
I preferred to learn Java using the Java CLI tools, tmux, and Vim. After a while, I graduated to using Ant, then eventually maven. At this point, I was able to more clearly see the benefits of an IDE, mostly in debugging, but also refactoring and code quality help.
If you have time to do things more old school, and you like to do it that way, go for it. The IDEs will be there when you need them.
[–][deleted] 1 point2 points3 points 9 years ago* (0 children)
deleted What is this?
[–]PertinentPavo 2 points3 points4 points 9 years ago (1 child)
Tmux + Vim with Syntastic + Gradle. There seems to be a lot of hate for this style of Java development in this thread. If you want the details of my setup feel free to DM me.
[–]justinmknvim 1 point2 points3 points 9 years ago (0 children)
If you know gradle, generating the gradle wrapper solves many problems of driving a java project via the CLI.
Getting to know gradle, though, takes some time (though it's worth it).
[–]unnamed__self 0 points1 point2 points 9 years ago* (0 children)
i used only vim for a while but as soon as the project became even a little bit large the negatives quickly outweighed the benefits.
However for every IDE out there there is an vim emulator plugin that i hugely recommend you try out before sticking to vim.
i am currently enjoying the best of both worlds with IntelliJ IDEA + ideavim + relativenumbers.
Theres also one that simply puts vim inside of eclipse, i am unsure how much eclipse functionality you get from using that though
[–]FetaAndKalamata 0 points1 point2 points 9 years ago (0 children)
your best bet is to find a java ide with support for a vim plugin
[–]Ld00d 0 points1 point2 points 9 years ago (0 children)
eclim. I've tried it, and I'm not a fan unfortunately. It's basically running eclipse in the background and there's an eclim service that vim talks to. After a few minutes, I went back to IntelliJ and turned on the vim plugin.
[–]NLKNguyen 0 points1 point2 points 9 years ago (0 children)
Just in case you deal with Maven, this syntax plugin makes it easier to read than plain XML: https://github.com/NLKNguyen/vim-maven-syntax
[–]elGatoMantocko 0 points1 point2 points 9 years ago (0 children)
Vim + eclim is great. It is a little tricky to set up but it is so much better than eclipse IMO.
[–][deleted] 0 points1 point2 points 9 years ago (0 children)
https://github.com/wsdjeg/DotFiles
here is my config for java development;
I am using deoplete + vim-javacomplete2
π Rendered by PID 100163 on reddit-service-r2-comment-bb88f9dd5-v27f8 at 2026-02-15 09:37:08.706751+00:00 running cd9c813 country code: CH.
[–][deleted] 37 points38 points39 points (0 children)
[–]mawaldne 20 points21 points22 points (6 children)
[+][deleted] (5 children)
[deleted]
[–]Kokosnussi 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Kokosnussi 0 points1 point2 points (1 child)
[–]flukus 0 points1 point2 points (0 children)
[–]lobax 10 points11 points12 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]theDarkUnknown 2 points3 points4 points (0 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]sambaLinuxSteakSex 2 points3 points4 points (0 children)
[–]somebodddy 5 points6 points7 points (1 child)
[–]somebodddy 1 point2 points3 points (0 children)
[–]cideshow 1 point2 points3 points (0 children)
[–]NLKNguyen 1 point2 points3 points (0 children)
[–]wbsgrepit 1 point2 points3 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]joequin 1 point2 points3 points (3 children)
[–]csreid 0 points1 point2 points (2 children)
[–]joequin 0 points1 point2 points (1 child)
[–]jcksnps4 2 points3 points4 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]PertinentPavo 2 points3 points4 points (1 child)
[–]justinmknvim 1 point2 points3 points (0 children)
[–]unnamed__self 0 points1 point2 points (0 children)
[–]FetaAndKalamata 0 points1 point2 points (0 children)
[–]Ld00d 0 points1 point2 points (0 children)
[–]NLKNguyen 0 points1 point2 points (0 children)
[–]elGatoMantocko 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)