Move visual block up or down easily.

47 Points

Chris Penner Chris Penner

2 years ago

Rebinds J and K in visual mode to move block up or down in relation to the other lines, while keeping the selection.

This version also re-indents the line to match indentation rules in its new position. (if you don't like that, remove the 'gv=' in the middle :D)

" Move visual block
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv

Sævar Berg

Sævar Berg 2 years ago

This is friggin' awesome!

mesrine

mesrine 2 years ago

/sign

craigp

craigp 2 years ago

This is an epic tip

Jay

Jay 2 years ago

I <3 you. (in the straightest way possible)