In a very long file with (accurately-) indented code, it may be helpful to move directly to a line of text above or below the cursor which delimits the indenting.
(One way of doing this could be via the indent foldmethod, by folding the current indent level, which collapses the lines delimiting the indent level to be only a j
or k
away from the cursor. However, I have found instances where indent folding hasn't been able to work on the indent I'm interested in.)
Here's an example, with the cursor marked by the underscore _
(at the second character column between the definitions of class Bazz
and class Qux
), but imagine that the number of paragraphs or lines within the module
s is unknown or variable:
module Foo
# lots of code...
end
module Bar
class Baz
# ...
end
class Bazz
# lots of code...
end
_
class Qux
# ...
end
class Quux
# lots of code...
end
end
...how could I quickly navigate to the o
of module Bar
above the cursor, or the n
of the end
below the cursor at the very last line? Note that the vertical column contains whitespaces, but also no characters at the second column in between the class
definitions.