As source code is usually indented, it will help navigate source code quickly if I can move to the next/previous row which has non-empty white character in the same column. Using below code snippet as example and the cursor in on the last }
, is there a way to navigate the cursor to i which starts if
?
if (condition) {
// some code
}
I've now implemented this motion in my JumpToVerticalOccurrence plugin; by default mapped to ]|
/ [|
. There are other, related mappings like a ]V{char}
mapping that works just like f
, but vertically.
So if you don't mind installing a plugin (plus dependencies), this is more robust and functional (it supports [count]
as well).
Not exactly what you're asking for, but if you start at }
and hit %
, the cursor moves to the matching {
.
If your code has a defined indentation system, jeetsukumaran/vim-indentwise works well for relative, absolute, or block-scope movements across indented blocks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With