Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For me, it's about the interface. In descending order: intuitive, consistent, modular, comfortable, portable.

Intuitive: most commands resemble natural language, without awkward or arbitrary mappings. For instance:

- w: (forward) word;

- cw: change (forward) word;

- c2w: change 2 (forward) words;

- 2cw: twice change word;

- ciw: change inner word;

There is no intervening translation. For instance, to change a word in mainstream editors, you delete it first, then start entering the new text. In Vim, it's one command: you think "change forward word", you issue the "change forward word" command.

Consistent. For instance, double letters work on lines:

- cc: change line;

- dd: delete line;

- yy: yank line;

and capital letters work till the end of the line:

- C: change till the end of the line;

- D: delete till the end of the line;

- Y: yank till the end of the line (not so in vanilla Vim, but I've remapped it because consistency matters to me).

Modular: you compose commands. For instance, / is the search command and then:

- d/testo: delete until the next occurrence of "testo";

- c/testo: change until the next occurrence of "testo";

- etc.

Comfortable: limited usage of modifier keys. Vim saved me from RSI.

Portable: letters and Shift keys are in the same position on any keyboard, be it on a desktop, a laptop, etc. whilst each laptop manufactures has its own idea about where Control, Alt, Arrows, PageUp and PageDown should be.

Hope this helps.



I'm sorry, but although I'd agree vim is awesome, there's no way I would call its commands "intuitive." Take 'y', for 'yank.' Would anyone really argue that the word "yank" is a natural way of expressing "copy?" "Yeah mom, just yank and paste that into an e-mail... " And there's nothing inherently intuitive about '/' for searching, unless you're already familiar with unix commands like sed. Or ":" for go to line. Or "x" for delete letter. Or "jkl;" for movement, for that matter. Etc... etc... etc...

A lot of people here have made the point that vim has a steep learning curve that eventually pays off, which, to me implies that intuitiveness is either lacking or besides the point. Still, I agree with your other points. I'm thinking of going back to it to minimize hand strain.


It's not that individual commands are intuitive. Yes, you need to learn the verb for copying is y (and is called yank), the verb for deleting is d. The "intuitive" part comes once you have a basic vocabulary. You can then learn a new action and already "intuitively" know advanced ways to use it.

If I learn the new verb c, which deletes and puts me in insert mode, I already know that I can type c3w to change 3 words, or ci" to change the phrase inside quotation marks.

Because all verbs work on the same set of nouns and adjectives I can intuitively know what many commands do - even though I've never tried them - as long as I understand the parts that make up the command.


I agree that there are some trade-off, but other editors have their trade-offs as well. IMO, Vim's trade-offs are acceptable. Actually, / for search is traditional beyond Unix: Opera and Firefox understand it. And ? (which is Shift + /) searches in the opposite direction (a smart trade-off). x, while not literal, is descriptive: think about drawing an x over a character to "delete" it. hjkl, while not mnemonic, are so often used that that it is advantageous having them there and muscle memory develops fast. Goto line is also <line number>G, more mnemonic.

I think the steep learning curve comes from the need to learn a richer and more precise way of editing, while you may be used to get by with a sloppy one. I had a similar experience when I switched to the Dvorak keyboard: I learned for the first time how to touch-type, while the Qwerty grew on me from hunt-and-peck.

Since you are considering about going back, here are some useful custom mappings of mine: - swap p and P; - map Space as PageDown; - map Shift + Space as PageUp; The last two mirror the way most document-displaying applications work. Generally, don't think twice about remapping some commands either to correct historical quirks of Vim or make it behave consistently with other applications you may be using, hence lowering your memory load.

Have fun


Er, "hjkl" for input?


Main stream editors work differently...

Change forward word is in a mainstream editor: [Shift]+[Ctrl]+[Right]

Change line: Home, [Shift]+[End]

...and so on...

Moreover you forgot to mention that you always need to switch modes...

Mainstream editors are pretty efficient, unfortunately in the UNIX World there are hardly any good ones. The best ones I can think of are Eclipse and gedit.

Unfortunately there is no Notepad++-like thing on UNIX. (And Kate just became messy and buggy when KDE4 came out.)

BTW: Has any vim fan ever used the refactoring feature in Eclipse? Or edited Code during runtime using the Graphical Debugger? I doubt it... ;-)


> Main stream editors work differently... > Change forward word is in a mainstream editor: [Shift]+[Ctrl]+[Right]

I stand corrected.

> Change line: Home, [Shift]+[End]

Here there is a translation at work: the editor lacks an atomic "change line" command, so users resort to "move cursor to the beginning of line, then select text up to the end of the line", which is something you could do in Vim, too, if you wanted.

> Moreover you forgot to mention that you always need to switch modes...

I don't understand. Do you mean you have to switch between Insert and Normal mode? If so, this is where newbies - including me some years ago - make their bigger mistake: you don't linger in Insert mode, you hit Esc as soon as you end entering text. Either you are typing text, or you are in Normal mode. This is the reason you need the Esc key as easily accessible as possible. On my keyboard, it is on the Caps Lock key. And : is unshifted.

> BTW: Has any vim fan ever used the refactoring feature in Eclipse? Or edited Code during runtime using the Graphical Debugger? I doubt it... ;-)

I'm with you on this. Still, people confuse Vi-style editing with either Vim or other Vi clones. Vi-style editing is neither Vi nor Vim nor Elvis nor [name an editor]. I used Eclipse and Visual Studio, yes, and guess what: I had Vi-style-editing plugins on both. What people call "the best of both worlds".

EDIT: Vi-style editing rocks at editing text, which is a subset - or not the same - of editing code. A user editing code with a mainstream editor offering powerful code-completion and refactoring facilities may have at her disposal a more powerful tool than a user editing code with a Vi-style editor lacking such facilities.


Sure, vi-style editing is something I also find awesome. The key combinations are really smart and I love the shortcuts D and dd, or search through a file with n and N.

And yes, vi(m) is inferior to much less sophisticated editors when it comes to juggling large chunks of code. Or maybe not...

Anyways, now that I have a Macbook, I need to learn vim because it lacks all the cool keys you have on a PC keyboard :D At least I'm now using at nearly as productively as gedit or the like. (On average)

BTW: This caps-look trick is awesome, I'll set it up now!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: