Suppose I have many lines of various indentations. E.g.
qqqq wwwwwwww eeeeee rrrrrrr tttttt yyyyyyy
If I am anywhere on the fourth line above which is blank. Is there a shortcut to jump the cursor to directly under the first
e of the third line?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
I don't believe so. Does the blank line have whitespace or is it totally empty? If the former you can use something like this:
:nnoremap <leader>^ kg^j
Or, courtesy of Mass, just
:nnoremap <leader>^ -j
<leader>^ can be replaced with any unused key combo you like. Enter it while in Normal mode and you'll get the effect you need. (If you want it to work with wrapped lines, too, then use
If the blank line is totally empty there's no easy way to go to an arbitrary column. You have to insert the appropriate amount of whitespace first. (Well, that's a bit of a lie...you can use
:set virtualedit=all but that's probably going beyond what you have in mind.)