I like the - and <C-M> normal-mode keys for going to the first non-whitespace character of the previous/next line.
Are there coresponding keys for going to the last non-whitespace character on the previous/next line?
I like the - and <C-M> normal-mode keys for going to the first non-whitespace character of the previous/next line.
Are there coresponding keys for going to the last non-whitespace character on the previous/next line?
g_ moves the cursor to the last non-blank character of the current line. From Vim's :help g_:
g_ To the last non-blank character of the line and
[count - 1] lines downward |inclusive|. {not in Vi}
Unfortunately, I think the only options you have to move to the non-blank character of the previous/next line is kg_ or jg_ respectively or using a count to move downwards.
However, it is easy to map them to something easier:
nnoremap <F3> kg_
nnoremap <F4> jg_
If you mean the next non-whitespace character of the previous/next lines (by going vertically), then try:
map <C-k> :call search('\%' . virtcol('.') . 'v\S', 'bW')<CR>
map <C-j> :call search('\%' . virtcol('.') . 'v\S', 'wW')<CR>
2g_will also work if you want to go to the last non whitespace character on the next line. However, this can't be used for the previous line. The advantage of2g_is that it can be repeated with.– EvergreenTree May 17 '15 at 13:27g_) are not repeatable with.. Generally, only things that change the state of the buffer can be repeated. – tommcdo May 17 '15 at 22:01