News for hackers. Stuff that matters.
Re:Switching from Vim to Intellij by simias on Thursday November 05, 2020 @06:26PM (#25003243)
>Everything is pre-configured: You don’t have to worry about setting up tags, or YouCompleteMe, or NERDTree. I can’t tell you how many times I open a new project, perhaps in a different language, and everything works great out of the box. It’s a total sigh of relief.

I agree 100% here, if you value these types of IDE tools I don't recommend going to Vim. It frankly sucks at this stuff, it wasn't meant for it and it's not the type of things you can easily tack onto a codebase not meant for it. Doesn't stop people from trying of course, and some do an amazing job at it, but it rarely reaches the same level of polish and simplicity as good IDE solutions.

But on the other hand, please consider the Zen of dumb tools: I code all day in Vim and I don't use YouCompleteMe, NERDTree or anything like that. I use dumb, language-agnostic completion and dumb, language-agnostic FZF and Rg for searching and navigating the source code. If I'm feeling fancy I use universal-ctags, but if it's not here FZF and Rg do a good enough job.

Is it as fancy and fully featured as an IDE? No. But like the author I like when stuff just works, and dumb tools work reliably regardless of what I'm editing. It works in emails, it works in man pages, it works in custom DSLs, it works in config files, it works in HN comments if I decide to edit them there. And it's always instant.

Re:Switching from Vim to Intellij by tsimionescu on Friday November 06, 2020 @02:01AM (#25005603)
> But on the other hand, please consider the Zen of dumb tools: I code all day in Vim and I don't use YouCompleteMe, NERDTree or anything like that. I use dumb, language-agnostic completion and dumb, language-agnostic FZF and Rg for searching and navigating the source code. If I'm feeling fancy I use universal-ctags, but if it's not here FZF and Rg do a good enough job.

I understand this preference, but it's also important to recognize that you are essentially programming with one hand tied behind your back when you are choosing to use such tools instead of an IDE when one is available.

For example, free IntelliJ can do "Data flow from/to here" analysis on your code for Java (probably others as well), which analyzes your whole project and finds all the code paths that use/provide a value for a variable, at any depth of calls. For a medium-sized product, finding the same information with Rg is easily 30m of work; if you need to navigate between the levels to find a bug, you'll lose even more time.

Also, refactoring tools that an IDE can give you make certain programming tasks trivial at 3-5 key presses which would easily be a 2 day change in a medium project using basic text processing tools.

Especially now that most IDEs also support VIM or emacs key bindings, it is very rarely a good idea for medium-to-large codebases to rely on text processing tools instead of a full IDE. Note that I'm also considering vim/emacs+language server or similar extensions as an IDE (though LSP has quite a way to go, especially on the refactoring side).

For small projects, or for languages with poor code analysis support, I do agree that these advantages don't amount to much and personal preference and familiarity amounts to much more than any tools an IDE can give.

Re:Switching from Vim to Intellij by theonemind on Friday November 06, 2020 @02:27AM (#25005745)
I land in the "if you need an IDE, you already took a wrong turn" school of thought, basically Paul Graham's position in this old post: https://news.ycombinator.com/item?id=72710

granted, we don't always get to choose what language we use or what code bases we inherit.

Re:Switching from Vim to Intellij by tsimionescu on Friday November 06, 2020 @02:42AM (#25005824)
That's a very strange attitude from someone who proselytizes Lisp, the language which pioneered IDEs about 30 years before other languages really had anything comparable.

Emacs, for Common Lisp, is still a much more advanced IDE than many languages have. It used to actually be a significant ingredient in the secret sauce that made Lisp so powerful - an advantage which it has thoroughly lost to IntelliJ/Visual Studio in my opinion.

Re:Switching from Vim to Intellij by nemoniac on Friday November 06, 2020 @04:12AM (#25006233)
There's a school of thought that Slime in Emacs is such a different beast from what is generally considered to be an IDE that it doesn't belong in that category. My guess is that pg belongs to that school.
Re:Switching from Vim to Intellij by pjmlp on Friday November 06, 2020 @04:22AM (#25006279)
I guess that is because Emacs is just a fraction of what Common Lisp environments are capable of, so what gets happy with what they can get (as free beer).
Re:Switching from Vim to Intellij by freedomben on Friday November 06, 2020 @09:53AM (#25007962)
> it's also important to recognize that you are essentially programming with one hand tied behind your back

I understand what you're saying but as someone who went the other way (from IDEs to Vim exclusively) I disagree (except for Java, for Java an IDE is mandatory as a result of the way the ecosystem/culture has developed in an IDE centric way).

There are benefits to lack of features. It's a tradeoff of course, but I find that the super simple language agnostic Ctrl+N autocomplete gets me 85% of the way there, and it's so predictable to me that I don't usually need to even look at the menu. I fly through it. With IDEs I find myself having to think about it more closely, and look at subtext for context. That's just one example.

So while I don't disagree with you necessarily, I think IDEs also (metaphorically) require tying some part of your hand behind your back. They are just different parts.

Re:Switching from Vim to Intellij by tsimionescu on Friday November 06, 2020 @10:02AM (#25008037)
I don't disagree with you. However, I think your example is not great and it's pretty representative of what I've seen many people who prefer vim use.

To me, writing code is a relatively minor part of software development, so auto-complete and such are nice to have features, but not crucial. Dumb auto-complete is absolutely good enough, even for Java.

Reading code, especially navigation and analysis, is a much greater part of the day to day experience that I for one have, and here grep is so inferior to code analysis tools that I really don't understand how people can use it.

Note that I am currently an Emacs user (company won't pay for GoLand), but the extra value added by lsp-mode is maybe a quarter of my productivity.

Re:Switching from Vim to Intellij by freedomben on Friday November 06, 2020 @04:33PM (#25011404)
You make a great point: I wasn't considering code navigation. I did indeed get a ton of value from that back in the day.

For most of what I do the symbol is defined/used in the same file, so a simple `*` (Shift + 8) will get what I need it, but when it doesn't then I'm relegated to grep (I actually use a tool I wrote myself called findref[1]). It gets me 70 to 80 percent of the way there, but that's it.

To me that's "good enough" that when combined with the other benefits of plain vim over an IDE (especially ability to work over SSH like it's local, which I do a lot), it's worth it to me.

[1]: https://github.com/FreedomBen/findref

Re:Switching from Vim to Intellij by tsimionescu on Friday November 06, 2020 @07:35PM (#25012403)
Sure, I completely agree that you get 70-80% of the way there with very simple tools, and there is value in that.

Just one note about SSH: Emacs and VSCode have a nifty way of doing the opposite of how you use vim over SSH: I can run Emacs on my own system and edit remote files directly and even run remote commands. This has the nice advantage that I get to use my own customized Emacs but still edit files on all sorts of remote systems, including stuff like kubernetes-mode or other niceties.

Re:Switching from Vim to Intellij by TylerE on Thursday November 05, 2020 @09:34PM (#25004335)
The killer thing for me is how IntelliJ has the best cross-language embed support.

So it not only knows when strings in my python code are sql queries, but it autocompletes in those strings against my actual schema

Re:Switching from Vim to Intellij by mdaniel on Friday November 06, 2020 @11:05AM (#25008606)
And I recently learned that it will open the embedded language in its own editor pane (ala editing code in org mode, if that means anything) and can be a less distracting way to edit without the mental encode/decode cycle

It may have been implied by the "it autocompletes" statement, but it runs analysis on that code, too, catching bad practices such as logic errors, common mistakes, and unused code (where applicable)

One can influence its embedded language detection via `language=RegExp` (or whatever the language id is) while inside a comment right above the embedded language literal: https://github.com/JetBrains/intellij-community/blob/idea/20...

Re:Switching from Vim to Intellij by willberman on Thursday November 05, 2020 @08:21PM (#25003922)
+1 on vim with fzf and rg being enough for almost any task. I use that setup for most things and then when I need something with a little more syntactic awareness, I pop open my IDE.
Re:Switching from Vim to Intellij by higerordermap on Friday November 06, 2020 @12:18AM (#25005123)
I know vim isn't for people who want everything set up out of the box.

But I think installation of the extensions for LSP / completion / navigation etc.. features could've been easier. In my limited experience, it's a hassle getting these tools to work.

Re:Switching from Vim to Intellij by apazzolini on Friday November 06, 2020 @01:46AM (#25005540)
This will get a lot simpler in the next couple of months when Neovim 0.5 ships with built in LSP support.
Re:Switching from Vim to Intellij by higerordermap on Sunday November 08, 2020 @09:04PM (#25030769)
Wow. Good to know. Thanks.
Re:Switching from Vim to Intellij by dotancohen on Friday November 06, 2020 @09:16AM (#25007705)
VI (or VIM) the text-editing language is terrific. VIM the text editor is just a basic editor like notepad, that just happens to speak VI[M?] the language.

IDEs exist that also speak most of the language. IdeaVIM is an extension to IntelliJ that speaks 90% of VIM the language (and also gets some things wrong). I live in IdeaVIM almost all day.

Re:Switching from Vim to Intellij by dbtc on Thursday November 05, 2020 @11:49PM (#25005004)
How do you hook vim up to email and HN comments?
Re:Switching from Vim to Intellij by leephillips on Friday November 06, 2020 @09:20AM (#25007730)
I use qutebrowser, and one keystroke opens vim. When I close the editor the contents of the Vim buffer appear in the browser text-entry input.
Re:Switching from Vim to Intellij by mr_mitm on Friday November 06, 2020 @02:25AM (#25005736)
Email is easy if you are using mutt. HN comments... I'd like to know that, too. Before Firefox switched to WebExtensions, there was a plugin that opened gvim when you pressed some hotkey while the focus was on an textarea. Now there is textern, but it requires some additional binary.
Re:Switching from Vim to Intellij by simias on Friday November 06, 2020 @04:26AM (#25006307)
There still are plugins, you just need a helper tool on your system to run the actual commands.

Tridactyl provides the feature but if you just want external edit without the intrusive vim binding layer you can try Textern, it worked well back when I tried it.

Re:Switching from Vim to Intellij by akalsz on Friday November 06, 2020 @08:19AM (#25007391)
For email mutt is obvious, but I also recommend aerc, though it's still beta and does crash sometimes. And I'm writing this from w3m, in which you can just navigate to a textarea and write to it in your $EDITOR. For general browsing it's not that great due to its lack of js/css support, but I find it great for commenting on forums which usually still work with html forms. Interestingly, w3m used to work with gmail as well, but sadly you can no longer log in without javascript.