Trick to shift lines in Vim
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 vimrc (or init.vim): 1 2 3 " Move visual selection vnoremap K :m '<-2<cr>gv=gv vnoremap J :m '>+1<cr>gv=gv Then select lines using visual mode (v or V) and press J or K to shift them down or up one line, respectively....