Comment by blahgeek

1 day ago

I’ve been using vim for 10+ years. However I honestly don’t see the downside of repeating h or j to move up/down (with the key repeat delay adjusted to a small value). It’s more intuitive than using say 15j, which involves recognizing some number in the screen and then look at the keyboard to type because the upper number row cannot be easily touch typed

I was the exact same until I started using relative line numbers. Then I can just look at a line and see that it's N lines down and jump there immediately. With j or k repeat I'll often over shoot and then have to go back which is kind of annoying.

There are countless more convenient keys that you can use to navigate up and down without counting. Basic ones are /, *, n, N, H, M, L, {, }, %, ctrl-]. ]c, [c when you're in a diff buffer or have a Git plugin that offers this key. ]d, [d, [q, ]q, ]l, [l if you use Neovim.

Agreed. I wonder if this is somewhat revealing of the mental processes of the creators.

To me, if my cursor is a few lines away from another line, the easiest way for me to get there is by either using h/j a few times, or looking at the absolute line number and doing that with gg.

Relative jumps are only useful to me in macros. Calculating a relative jump myself would 100% pull me out of the flow state where I just want to go up/down a few rows.

I have no proof of this, but I’d guess that the creator of this pattern didn’t feel the same way.

  • The best tip I got, was to rely more on search instead of other kind of movement. Especially when doing a bunch of editing. Things like easymotion/sneak/avy works best when reading/reviewing.

    While I loved multi cursor with sublime. After I moved to Vim, I’ve never needed it. It’s either search~repeat or a macro. Now I’m using emacs, and it’s mostly occur-mode and macro. Grep edit is nice for bigger refactoring.

    • I really, really like flash/easymotion/etc because I effectively also use the same jump motions all the time in my browser (with vimium/tridactyl). So I have double the muscle memory, and I context-switch less between my browser and neovim, compared to if I was primarily using relative line jumps in neovim

  • Why would you ever calculate relative jump yourself instead of having relative line numbers in the gutter?

    And yes, for a few lines it's fine, the plugin has this number configurable.

  • Getting used to thinking about multi-line motions via 5j helped me train to visualise lines that way.

    Over time, I started using things like 13dd or 7yy with more ease.

    Of course, `set relativenumber` is always recommended.

    > Calculating a relative jump myself would 100% pull me out of the flow state where I just want to go up/down a few rows.

    Yeah, you can't be a purist about it. If you're hard-focused and jjjjj is the first thing that comes to mind, then that's fine. When you're doing lighter work is when you have the spare mental capacity to train and improve on your workflow.

It's nice to have good tools that are practical for navigating around the text.

For jumping around what's on screen, I think 'easymotion' ("jump anywhere on screen by pressing two characters") & variations are best in terms of how quickly they let you navigate for how easy it is to use.

You don't need to use the upper row, bind numbers to right thumb modifier + numpad-like uio jkl m,.

Or instead of 15j use another jump to command that accepts those letters as numbers

Or have some jump type of command that displays a-z labels 1 per row in the middle and you can jump without numbers and without shifting focus to the gutter

But yes, the most basic motion will still be more "intuitive"

I've pretty much always struggled with this too. I have a numpad that I can touchtype easily but if I'm taking my hands off homerow I may as well use a mouse at that point.

Also gives me time to plan what I'm going to do once I get there. Or I spot a bug/relevant code snippet along the way.

Huh, I don't find the number row very difficult to touch type. But then again, I do have long fingers.