Hacker News new | ask | show | jobs
by muh_gradle 3397 days ago
I've used vim and emacs. I can't claim to be an expert on either, but I am somewhat comfortable with vim and it can be convenient for any unix straight out of the box. But I found it to be fairly overrated even with all these claims of boost in productivity. Just use Sublime Text in this day and age and use the spare time you would've had to learn vim and do something more useful.
6 comments

Usually when so many people are saying something, and one's reaction is "I don't get it, I guess I'm missing something", they are, in fact, missing something. You can't really know what vim does for you until you commit to it and actually use it. Then over time the usefulness gets greater as you learn more things.

If you expect everything to be completely apparent to you the first time you look at something, that says more about your approach than the value of the tool.

Well no not really. I've used vim throughout college and still do use it on occasion. But I have found it to not be as important to programming as a lot of people claim. If vim is that much more superior than other editors, by all means. I have not found that to be the case at all.
I've always been wondering if there is some secret that I've been missing and that these VIM or Emacs gurus keep to themselves which makes them "more productive".

All these abstract claims in blog posts and on forum pages about productivity are completely worthless. Go watch a stream where you can actually see someone program. Maybe you'll pick something up that they do better/faster/more elegant than you. Other than that, the best advice is to ignore these kinds of topics.

I don't know about being more productive but I use commands like 3cwfoo<esc> to replace the next three words with foo. Or 2cf,foo<esc> to replace everything including the second comma on the current line. Or some : command. I no longer even consciously think about such things as how vi works is something I know in my fingers. Originally I learned such things only after repeating some command multiple times, thinking there has to be a better way, and then learning the more powerful commands. The core set of vi commands is quite regular and once you learn something it can be applied in other situations.

If I am working with another expert vi user it is very easy to give him precise instructions - I can just say things like replace the second foo with bar on every line starting with a space and he'd know to type the correct : incantation.

The key is to pay attention to your inner voice saying "there has to be a better way" and doing something about it! Bottom line: learn to know how to use your everyday tools well.

I also was rather sceptical wrt Vim at first; the only reason I ever started using it was that I needed a text editor that compiled for ARM architectures (I wanted to use it in a chroot on my chromebook). After a couple of hours the distrust got to "hm, this might not be too bad". After a couple of days I switched my ZSH to Vim bindings. Now I even use pentadactyl/qutebrowser for browsing the web.

The whole "Vim gives me amazing productivity" thing seems to be a personality trait: People telling you this are much more positive wrt tooling than I am. My basic gist is more like "why the hell can't I do X with this tool". I only started recognizing Vim's worth after getting more and more frustrated at other tools because they seemed to slow me down. Funny enough, I had the exact same experience a couple of years earlier after I got reasonably accustomed with Linux and Bash/ZSH. Learning them was more or less "meh", but coming back to Windows is a nightmare for me now. You have to do everything via the mouse, and the terminal seems almost unusable for me - it's not that I am amazed at how great my tools are (which, to be fair, they actually are), but I get very angry at any tool that doesn't at least do a decent job.

Luckily for me, this effect only seems to affect my experience with tools. I still can get very excited about APIs and programming paradigms :-)

I've been thinking about this lately, and whether my preference for modal editors is a historical accident, an adaptation to the limited resources available when I was an undergrad, or whether there's more to it. I think there's more to it. What separates vim and emacs from editors with a more forgiving learning curve is that they embrace a separate language for editing that's distinct from text entry.

That's not to say that other editors lack a meta-language. Even Notepad has Control-this and Meta-that. But vim and emacs (and my new favorite, kakoune) are all about using the meta language to manipulate text as much as possible, and only doing text entry when text entry is truly called for. Subjectively, I feel more productive using one of these, and completely hamstrung by IDEs, even when they supposedly support vim keybindings.

I wonder if that's the feeling too if you come back to a "normal" programming language after getting reasonably proficient in Lisp.

I see a couple of interesting parallels there - the biggest difference of Vim's modal commands to other control schemes (except maybe Emacs') is that they compose rather well. Add macros to that, and you can define (more or less) abstract editing functionality on the fly. It's basically a similar thing to what Lisp did to ASTs with it's homoiconicity and the macro system on top of it...

That is a very interesting point. I've been starting to study Racket, and although far from proficient, I can see the analogy. I really appreciate the lack of mental overhead for syntax, and I'm beginning to get a feel for how you might be able to plug things together.
I look at it like this:

When programming, you spend comparatively little time actually writing code. The vast majority of the time is spent reading existing code, and most of the remaining time is modifying the code you read. It actually pretty rare that you sit down and write an entire method or class in one go.

Most editors, however, always have you in the writing state: Just about any key you press will be added to the file you're looking at. If you don't want to add characters to the file, but still need to do things, you need to add modifier keys like Ctrl or Meta or Ctrl-Shift-Meta to the actual key. To move around the file, or between files, or search for more code, requires these longer chords of keypresses. To edit small bits of code require more chords. As such, the things that you do most of the time (reading, modifying) when coding require the most complicated keystrokes.

The default "mode" of an editor like vim is reading. Nearly all of the keys you can press in that mode are just to move the view around or switch files. Eg, the keys to move by a single character (`jkl;`) are all on the home row. To move to the next block of code is simply `]`. To jump to a specific character is `f` + that character. To find some string is `/`, and then `n` jump between matches. And then to copy/paste some code is just `y` and `p`. In any other editor, all of those actions would require one or more modifier keys. So in my mind, vim's primary advantage is that the sorts of things you're doing when coding take many fewer keystrokes, and hardly any modifiers that contort the hand.

And then on top of that, all of the actions one can take in vim can really be thought of as functions that take arguments. So you can use the "copy" action with any movement action (char, line, paragraph, find, etc...), and that's the part that will be copied. Prefix an action with a number, and it'll be repeated that many times.

It's this mindset that few other editors can manage (and even the vim emulators miss some of the really cool stuff), which is why they have have my vim when the pry it from my cold, dead, carpal-tunnel-laden hands.

If you're only considering moving your cursor around and editing text, then Sublime Text probably makes sense, but there's a lot more to Vim than just that. Macros, for example, are a powerful part of Vim that save a ton of time and effort, and aren't readily found in other editors.
On the contrary, I do use SublimeText...with Vintage Mode / Vintageous for Vim keybindings, because I find them so incredibly useful.