Hacker News new | ask | show | jobs
by capote 3722 days ago
You first need to learn the differences between these editors, and determine what you expect from an editor.

It's pointless to compare vim, atom, and eclipse in the same thought process because they're completely different tools for different tasks.

> ... as to why vim is superior

Vim is not superior categorically. If you expect your editor to autocomplete Java code for you and fill in imports and look up methods for you, and have extra features that aren't even connected to editing, Eclipse is tremendously better. But Eclipse is a different tool. It's a full IDE.

Atom is a gui-based editor.

Vim is a cli-based editor.

I've been seeing people left and right comparing editors as if there were some definitive lockdown about to happen that binds you to a single editor. Use whatever you like and what gets your job done. You can also use more than one for more than one task.

I use vim when I'm editing files via ssh remotely, Sublime when I'm editing local files, and VS Pro when I'm working with .NET at work, because these are, respectively, my tools of choice for these tasks.

None are "better" or "worse". They're just different.

4 comments

Now, all that said, I do have a story about speed with Vim:

When I was in high school, I bragged to my dad about typing something like 110 words per minute. He said… that's nice; I can type 1100 words per minute. Incredulously, I asked him to show me. He fired up his vim setup, opened a few files, started a new one, and sure enough in under 60 seconds he had a ~1100 "word" Sybase stored procedure (or something) written.

Of course he didn't literally type all of it. Of course it was a loooot of copy pasta, and the whole thing was tongue-in-cheek. But it was a good example of what you can do with Vim given the right scenario.

With a ctrl-a, ctrl-c, ctrl-v loop you can "type" exponentially fast in any editor, I guess.
It was a little more complex than that because the new stored procedure was indeed new and contained different structure, as far as I remember. ;) but yeah, copy pasting definitely takes a bit of the elegance out of it.

Most of what was demonstrated was Vim's superior capacity for jumping around to the correct place in your file precisely and quickly, which doing with a mouse is a nightmare.

Vim has a lot of key commands to quickly working with blocks of text so it is a bit more nuanced than that.

For example, to copy 3 lines from the cursor position and paste them 5 lines earlier:

3Y :-5 p

(and there are faster ways, some people are wizards)

I also do relative numbering in my vim (I have the current line labelled as 0, the line above it -1, etc) so that I can move around relative to the cursor without having to count lines. You can also do absolute numbering but I find that tedious when you have large files.

I know, I've been using vim pretty exclusively for the last 15 years or so.
Limited of course by cache reads for very large blocks of text.
Fully agree. Each type of editor excels at different use-cases.

vim/emacs. Once you get up to speed, you can type or move around faster than with other editors. The main reason to use these are because you're already spending most of your time in the terminal because you're a) working in an ecosystem like rails where most of the tooling is run from the terminal b) doing sysadmin tasks like editing config files, running ansible or otherwise writing code over ssh. That's the sweet spot. Once you become comfortable there are ways to extend the editors to basically give them ide-like functionality.

Gui-based text editors like Atom, Notepad++, etc. These are the simplest editors to get up and running and have a low level of bloat. You usually don't need to spend time waiting for it to load whereas most IDEs take 1-5 minutes to load up fully. The main reason to use these is ease of use. If you don't need the complexity of vim or an ide, use this.

IDEs work best when you are dealing with large codebases, especially if you're not familiar with the codebase or the available functions. I personally maintain ~600k lines of mostly undocumented code at work. It uses a custom framework and was contributed to by dozens of developers. There an IDE is probably the best choice because it will catch errors (made by you or past developers), it will autocomplete function names and best of all, there is a jump to definition feature so you can quickly trace through code paths. After two years of working here I can use vim without too much of a dropoff

Whenever someone gets too preachy about Vim or Emacs, I always imagine them trying to work on a full .NET project with Vim. Is this even possible? I can't imagine.
Just pointing out... autocomplete of Java code is completely doable in Vim. As are file trees and many things that IDEs offer.

With that said, there are also plugins for many editors that make vim commands work in them. Which is a nice compromise if you like GUIs.

It's just not the same as with Eclipse. I'm not sure what it's called or if it has a name, but the Eclipse equivalent to VS Pro's IntelliSense, in which it's actually aware of code that you've previously written in other files or third party libraries, and it pops up as a little list next to what you're typing--is it possible to have that level of functionality in Vim?

It's the actual awareness of code you've previously written, the detection of possible issues before you compile--IDEs tend to read your code with you and help out a lot in many more ways... I suppose it's not "autocompletion" but I was hoping to successfully use that as an umbrella term.

Yeah, it's probably not as good but AFIAK it does know about your other class files and things like that so for most people it will get the job done.

Take it with a grain of salt, though. There are 3 (that I can find) Java auto-complete plugins for Vim and I have no idea if any of them are good. (I don't develop in Java often and when I do it's trivial code so I haven't had a chance to try them)

Yeah, to be honest, I don't know much about Java and Java tools either; I'm just going by what I remember from school. I just assumed that Eclipse has similar functionality to VS Pro, which I know we couldn't replace with Vim.
Eclim is headless eclipse autocomplete in vim, so you get best of both worlds, pretty much.
this: https://github.com/henrikpersson/rsub

changed my life, now when I'm in ssh I can just "rsub this.txt" and it pops up in my currently running sublime window !

Neat—I've always known in the back of my mind something like this is possible but I just never looked around.