It’s easy to select lines in visual mode, delete them, then paste them a few lines lower. However, this won’t adjust the indentation to match surrounding code.
Instead, add the following to your
" Move visual selection vnoremap K :m '<-2<cr>gv=gv vnoremap J :m '>+1<cr>gv=gv
Then select lines using visual mode (
V) and press
K to shift
them down or up one line, respectively. This will also adjust the indentation
properly (the same as pressing
= while selecting the lines).