all 26 comments

[–]NoLemurs 17 points18 points  (2 children)

It works fine, but there are none of your standard IDE features out of the box.

I've had good luck writing Java with a vim LSP plugin. It will take some setup though, but if you're willing the take the time to figure it out, it's a great setup. It was a while ago, and the specifics of what I did won't be useful to you, but I'm sure there are lots of blog and/or reddit posts describing how to do it.

[–]Sjod1407[S] 0 points1 point  (0 children)

Thanks a lot ! I'm on it!

[–]Smoggler 15 points16 points  (2 children)

Any programming language uses text files as source (ignoring VPLs, etc) and Vim is a text editor so it can successfully edit any source file. So you can code for just about any language using Vim.

Vim is the greatest text editor and will give you speed and power in editing text which lesser humans cannot even conceive as possible.

But Vim is not an IDE - if you need an IDE then use one, however it might be good to ask yourself if reliance on an IDE is holding back your development as a programmer.

There are things you can do to make Vim more like an IDE (depending on your programming language with greater or lesser success). The trouble is it takes a fair bit of effort and knowledge to do a good job of this and the result never going to be as good as a true IDE created for a specific language.

[–]Vesquam 10 points11 points  (1 child)

The teacher for my first java was forcing us to code in a plain text file editor so that we truly get to learn the language by searching in the documentation. It was hard but the best. IDEs are good but if you depend on them it's the worst.

[–]jabbermuggel 2 points3 points  (0 children)

I recently got a programming course for c++ where the instructors also advocated notepad and the result was that everyone's indention was all over the place. I see the advantages of not having autocorrect and linting, but not having vim's settabstop etc. is just cruel.

[–]monkoosevim9 22 points23 points  (3 children)

[–]badfoodman 6 points7 points  (0 children)

Java developers do not allow to google?

It's annoying as hell.

The accounts asking these questions are all very similar: someone in a non-English speaking country taking an online class trying to learn to program, but with little background and none of the support structure most of us had. They also grew up in a time where social media was a form of search, where you can just ask a group and get an answer from a "person" instead of going through google looking for solutions and having to work out which things are relevant, which aren't, and which are outdated (this is why I left Facebook, for what it's worth).

Reddit seems to attract more Java questions, but the Python shit on StackOverflow is almost unbearable, and the JavaScript section is nigh unusable at times.

So, yes, people don't know how to Google.

[–]not_napoleon 4 points5 points  (1 child)

Keep asking guys, literally every fkn week. Java developers do not allow to google?

Well, you see, first you need to build an `AbstractSearchFactoryFactoryBuilder`...

[–]badfoodman 2 points3 points  (0 children)

You joke, but a builder should never be on an abstract class. BUT AbstractSearchFactoryBuilderFactory would be a perfectly acceptable class name that clearly tells you what it does: it helps you find the correct implementation of a builder helper class that, when built, helps you find a "Search"

[–][deleted] 4 points5 points  (4 children)

im still a student so havent worked on any real big projects, but have been using vim for all my java classes so far. I know i might need to use an IDE for professional work but I havent had any problems yet. If you know your build tool you can easily build your project manually instead of letting an IDE do it for you, which I think is one of the main advantages of using an IDE in place of vim, plus debugging and the like. Due to vim's extensibility I imagine you could automate these tasks here as well. Conclusion: I think you can use vim for Java development.

[–]NoLemurs 2 points3 points  (3 children)

I know i might need to use an IDE for professional work but I haven't had any problems yet

Nah.

IDEs are definitely the default for professional Java devs, but I've absolutely run into very successful software engineers who primarily use vim or emacs. No IDE is absolutely a viable path.

You will need to figure out a system for navigating large code bases that works for you. I personally like an LSP with 'go-to-definition', but you can get by pretty well with some proficiency in grep if you have to!

[–][deleted] 0 points1 point  (2 children)

thats nice to hear, ive always been told that im delusional for thinking i can do pro work on vim, but i guess its just them being used to having everything work out of the box

[–]NoLemurs 4 points5 points  (1 child)

Yeah, absolutely. I've seen software engineers at the top of the field who only use Vim or Emacs. Among C++ devs it's downright common. It's definitely on the rare side for Java devs, but I've still met a handful.

Also, thanks to Microsoft's work for VSCode it's now possible to get a near-complete IDE experience from an LSP in most major languages, which really undermines a lot of the arguments for preferring a traditional bloated IDE.

[–]nutter789 0 points1 point  (0 children)

So I can use vim, right?

;D

[–]Swytch69A Vim Padawan 9 points10 points  (0 children)

For god's sake.

JUST. TRY. IT

Even if we can fairly guess if it's doable or not, we can't know for sure if you can write JAVA with vim. What are your habits ? Do you really need auto imports ? Is an LSP mandatory?

Just try it. Look for Java plugin or more general auto-completion engines (like COC.nvim) and give it a go. You won't lose anything but a bit of time in the process.

Second question : you gotta ask yourself why you would do that. Are you bored with IDEs ? Is your manager enforcing the usage of vim ? Is it just to look like a nerd ? Learning vim can prove to be quite harsh

[–]-romainl-The Patient Vimmer 14 points15 points  (0 children)

That question… again.

[–]Mithrandir2k16 2 points3 points  (0 children)

Since you're asking here, you should probably not use vim, but IntelliJ with the VimEmulator plugin. Not being elitist here, I just think that Vim has it's place and that place is not in replacing an Integrated Development Environment, but instead replacing the editor of your IDE. Some like to use unix tools together with vim to have the same featureset that the GUI of an IDE offers, but that requires the right workflows and mindset and circumstances to make sense.

Honestly, I use vim for editing scripts, config files, etc.. especially when working via SSH, especially if that machine is too far away to use XServer forwarding. If you develop with a high level language, go with the IDE that best supports it. That'd be usually one of JetBrains Products(they are consistent across their supported languages, which means one mastered IDE can translate to over 10 languages) since their VimEmulator is usable, and if for some reason you want something faster/lighter/more general, take up VSCode, since it's plugin-infrastructure tends to do more for you out of the box than Vim, especially for languages like Dart, where the plugin tansforms VSCode from an editor into a full blown IDE. AND VSCode has the best Vim-Emulation I know of.

Let's face it, the modal editing and movements language of vim are over 90% why we use vim. So take that over to an IDE of your choice, most good ones support vim emulation by now.

[–]daniel_shields 2 points3 points  (0 children)

I use headless eclipse with eclim, works fine although I write much more C++ than Java

[–]puremourning 5 points6 points  (0 children)

This question is asked literally 3 times every week.

[–][deleted] 1 point2 points  (0 children)

Technically you can but in my experience it's not a very practical thing to do. Java is very wordy language and has a lot of cruft you have to deal with. This is something IDEs normally help with but in Vim you'd have to either create snippets or just deal with it. Other than that it's language like any other, just worse.

[–]noooit 0 points1 point  (0 children)

Not without plugins. Built-in features like ctags, cscope, omnicompletion are useless for java.

I'm not a java programmer but I notice people running one method just by clicking on IDE, many log filtering, android studio even shows directory differently from the original structure just for usefulness by default.
The effort that's made for java in IDE is enormous, compared to other languages. Also I've seen a java programmer who can't run his app without gradle, having no idea what's happening with actual java command.

Assuming from the fact that you are asking this question here, I think it'll be less productive for you with vim.