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

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.




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

Search: