Hacker News new | past | comments | ask | show | jobs | submit login

That's too broad of a stroke on what a programmer does with text. It's not just about editing. It's also about (a) moving to the point where you want to edit, (b) moving to an other point right after you just finished editing. Switching between the two becomes harder when you always have to Escape, compared to having direct access to an arrow key.

And (c) about editing. Why type an extra character (i for insert) to let you insert? Why not just type to insert?




In modern vim you do have direct access to the arrow keys. Rarely is this meaningful, for someone skilled in vim.

It can potentially be faster if you need to move just a couple characters over, but if you need to move 25? It winds up being something like: Esc 22hhhh

People navigate by jumping across words, across features, searching...


I wonder if there's navigation modern vim doesn't offer. Can you tell if or how you can do the following in vim?

In Emacs, Ctrl-<up arrow> moves the cursor ahead of a block of code. If you had a for loop for example, with a blank line where the for begins and a blank line where it ends, and the cursor was at the blank line where it ends, pressing the two keys Ctrl and <up arrow> would put you in the beginning.

How would you do this in vim? Would you have to first gauge how many lines of text up you should move?


Potentially depends a bit on the language and what plugins &c you have installed. For C on a basic install, you can say [{ to jump to the enclosing { (and there is the symmetric ]} as well). You can also use { and } to step over "paragraphs". And of course, if your goal is to replace the body of the for loop, ci} will delete everything inside the innermost containing {} and switch you to insert mode.


Yes, but unlike every other reply, I actually answered in one sentence didn't I? The fact that my sentence is difficult to grok for someone who is not already familiar with vim is hardly my fault.

But I'll elaborate on your points:

> It's not just about editing. It's also about (a) moving to the point where you want to edit

This is implicitly part of editing. vim offers more ways to move than any other editor, this goes directly to my point. Whereas in most editors you are crippled without a mouse, or at least clumsily moving around with arrow keys plus chords, vim have several movement commands that would not be possible without normal mode because you would just be typing text rather than powerfully moving around your document (eg. (, ), [, ], e, g, f, F, t, T, b, etc). Those examples are in addition to hjkl which are equivalent to arrow keys but of course more powerful because you can add number before them.

> Switching between the two becomes harder when you always have to Escape

No it's not, escape is just what you hit to finish a command. It's no different than hitting return at the end of a paragraph. It becomes reflexive and is far less of a burden over time than the extra key stroke of holding Shift, Ctrl, Alt, or Command keys which is taken for granted by non-vim users as the only way for keyboard commands to exist.

> compared to having direct access to an arrow key.

You can have direct access to arrow keys in vim if you want, but people recommend against it because newbies tend to use them as a crutch to avoid learning better movements. I'm not a purist, and I keep arrows in insert mode, but I map them more powerful things like switching tabs in normal mode.

> Why type an extra character (i for insert) to let you insert? Why not just type to insert?

Because in this one sentence I am typing there are 20 extremely powerful commands that I'm giving up in order to have the convenience of not typing `i` before I write the sentence.

Additionally, what if I want to insert text on a new line (o, O), or if I want to replace some text that is already there (c, C, cw, cW, c, 5cc, ca", ci[, etc)? `i` is not just an extra requirement, it's a choice about what kind of edit I want to make. Furthermore, when I'm done, if I want to insert the same text again I just hit `.`. Gaining fluency in this type of workflow leads to super optimized workflows, like manually find and replacing the word foo with bar:

    /fooc2fobarn.n.n.n.n.n.n.n.n.n.n.n.n.n.n
Of course find and replace is a special case, but the fact that you can do something manually with atomic key commands that merits a custom UI in other editors ought to give you pause. The pure text editing workflows that are possible in vim just with fluency in the basic commands are unparalleled.

IDEs can do a better job by building advanced tools for specific languages. Modern editors can do a better job integrating into the OS. Emacs does a better job at customizability. But nothing matches vim's raw editing capability on arbitrary text.


I learned a lot about how a vim user thinks and works from this comment. Thank you for explaining.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: