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
):
|
|
Then select lines using visual mode (v
or V
) and press J
or 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).