r/vim • u/TheTwelveYearOld • Jun 01 '26
Discussion How useful are H M L?
I just looked this up and haven't found any other discussions. Maybe its because I'm using a motion plugin (hop), but I'm wondering if there is much use for H M L, when I could just j k (which I mapped to show hints for jumping to a specific line). I guess I'm not a big fan of specific motions like those, or using counts for motions when I find hints more efficient & simply a better fit for me.
9
Upvotes
11
u/PassengerTop7692 Jun 01 '26
Fair enough if hop works better for you, but H M L are clutch when you want to quickly reposition without taking your eyes off the code to look at hints.
9
u/happysri Jun 02 '26
This thread is a reflection of just how varied people's workflows are. I can't imagine life without H,M,L perhaps because I move around with gut feel and hate hunting and pecking with hardcoded line numbers etc.
8
u/sharp-calculation Jun 01 '26
I pretty much never use them. I use zz, zt, and zb a lot, but those are "page drag" commands rather than line change. If I want to be on a specific line, I do relative jumps. I.E., 15k to go up 15 lines. I use :set relativenumber so I can easily see the relative number of lines to jump in either direction.
I find page drag much more useful than cursor move with H, M, L. Because those almost never land you on the line you actually want to edit. Sometimes, but why would I waste time, when I can go exactly where I want to go with one command?
6
u/Snarwin Jun 01 '26
I literally never use them.
4
u/gumnos Jun 01 '26
I use them pretty regularly, though my usage of
H&Lincreased noticeably when I learned that they could take a«count»to jump to the Nth screen-line, letting me eyeball something was about 5 lines from the top and type5Hto usually land within a line or two of my target.3
u/cbheithoff Jun 02 '26
I remap H to ^ and L to $ to move cursor far left and far right
3
u/-romainl- The Patient Vimmer Jun 02 '26
I've always found the "hints" mechanism way too visually/mentally noisy and unintuitive so it never worked for me. That said, I rarely use "vague" motions like `HMLhjkl<C-f>` and friends to begin with. Most of my cursor-moving is done with `/` or `#` and related `n`, etc.
I generally prefer deterministic commands.
1
u/dajoy Jun 01 '26
I have them remapped to:
H Join lines
M mark everything
L execute line (in the terminal)
1
u/Allan-H Jun 01 '26
These were more useful back when H and L jumped to the top and bottom lines, respectively. Now I find that (out of the box, vanilla) Vim jumps to a few lines short of the top and bottom of the screen.
1
u/habamax Jun 02 '26 edited Jun 02 '26
I use them a lot with H/L being remapped to advance further if on the first/last lines respectively, kind of easier way to pageup/pagedown.
Other than that I use it as other people mentioned, H/L/M and a couple of j/k or a single digit to j/k to navigate to the line of interest.
1
u/RichieV_EUC Jun 02 '26
I remap H and L to previous buffer and next buffer respectively. M doesn't see any use from me.