I have started using vim a while back, and I’ve been using the w, e, b and (my favorite) f/t motions quite extensively lately to move within the row efficiently.
To learn those motions, and break out my annoying habit of scrolling up and
down the page using jjjjj
and kkkkk
. I’ve used the vim plugin takac/vim-hardtime
.
This plugin did allow me to get more confident with horizontal
navigation, but one pain point still remains vertical navigation.
I always had the justinmk/vim-sneak
plugin in my config; it’s a great motion to precisely move vertically and
combined with <number>j/k, I can pretty much express all of the
vertical movement I want.
While I do use those motions quite often, and I cannot live without them, they
didn’t always felt as natural as the f/t motions.
vim-sneak
too heavy for line-wise operation, so I use <operator><number>j/k.vim-sneak
label indicator it’s very intuitive (let g:sneak#label = 1
).I’ve discovered a so-called edgemotion
motion while watching this video: youtube: vim-mode-plus: The most ambitious vim emulator in the world.
(Also learn a ton of other stuff).
The vim version of this plugin is made by haya14busa, vim-edgemotion
.
I have fixed one misbehavior in the interpretation; support for a preceding count number, and added support a feature to display counts numbers on the number gutter).
With those two modifications to the original plugin, I have now the best of both world:
vim-sneak
for precise jumps, and
<number>j/k for short line operation.vim-edgemotion
, when needed, I look
at the count number displayed in the line gutter.To conclude, edgemotion
helps for distinct line-wise operation, as it’s easy
to visualize the vertical edge of a code block. It also helps for ‘longer’ line
jumps as the number of edgemotion
jump is usually be a single-digit instead
of two when using the regular <number>j/k motion.
Here is my fork with the discussed changes pchampio/vim-edgemotion