Move the current line up or down. Add blank lines below or above the cursor.
Adapted from vim-unimpaired, but the mappings are dot-repeatable without dependency on vim-repeat.
No mappings are created automatically, add your own. I use the mappings as suggested by vim-unimpaired. Vimscript:
nmap [e <Plug>(move-line-up)
nmap ]e <Plug>(move-line-down)
nmap [<Space> <Plug>(insert-blank-line-above)
nmap ]<Space> <Plug>(insert-blank-line-below)
or with init.lua
:
vim.keymap.set('n', '[e', '<Plug>(move-line-up)')
vim.keymap.set('n', ']e', '<Plug>(move-line-down)')
vim.keymap.set('n', '[<Space>', '<Plug>(insert-blank-line-above)')
vim.keymap.set('n', ']<Space>', '<Plug>(insert-blank-line-below)')
Use [count][e
to move the current line [count]
lines upwards. Use [count]]<Space>
to create [count]
blank lines below the current line. Press [count].
to repeat last action.
Mostly taken from vim-unimpaired.
The Vim license applies, see :h license
.