Move to the end/start of vertical block (the cursor staying on the same column).
Usage: (default mappings)
nmap gk <Plug>ColumnMoveUp
nmap gj <Plug>ColumnMoveDown
xmap <A-k> <Plug>ColumnMoveUp
xmap <A-j> <Plug>ColumnMoveDown
Consider the following text, with cursor at [x]
; repeatedly pressing
<Plug>ColumnMoveDown
would take you to the marked positions.
" [x]..... ... ....... [x].... ... ... [x]
"
" .1....................1......................1..
" ..........................................
" .2....................2......................2..
"
" .............
" ... ....... ..3....
" .3.. .. .... .. ....................
" .... .. .... .. ..4.................
" .... ..
" .... ..
" .... ..
" .... ..... .... 5.................
" .4.. ..... .... ................... ..3..
"
" 6..................
" 5 7 4
EOF
Here is a low-quality screencast:
Untested and not intended for use with set wrap
.
Doesn't (currently) work with tabs and fancy double-width characters.
Make some noise (or a PR) if you're interested in having those implemented.
let columnMove_mappings = 0 " Disable default mappings:
Released under the JSON License.
Learn Vimscript the Hard Way (eternal thanks to Steve Losh)