Vim-line-motion allows the user to perform line-wise operations to move, delete, yank and paste lines. The idea originated from Chris Toomey's talk on writing Vim plugins and grew from there.
Install with your package manager of choice, or using Vim 8's native plugin support:
mkdir -p ~/.vim/pack/plugins/start
cd ~/.vim/pack/plugins/start
git clone https://github.com/aymenhafeez/vim-line-motion
If installed with Vim 8's native package management, add the following to your vimrc to generate help files for local plugins:
" Load all packages in the 'start' directory under each entry in 'packpath'.
" See :packloadall for more info.
packloadall
" Generate the help tags file(s) for directory {dir}.
" When {dir} is ALL then all 'doc' directories in
" 'runtimepath' will be used.
" See :h helptags for more info.
silent! helptags ALL
<Leader>k[count]
- move the current line[count]
lines up while maintaining the current cursor position.<Leader>j[count]
- move the current line[count]
lines down while maintaining the current cursor position.<Leader>dk[count]
- delete the line[count]
lines above the current position.<Leader>dj[count]
- delete the line[count]
lines below the current position.<Leader>mk[count]
- move the current line and cursor[count]
lines up.<Leader>mj[count]
- move the current line and cursor[count]
lines down.<Leader>rk[count]
- replace the line[count]
lines above with the current line.<Leader>rj[count]
- replace the line[count]
lines below with the current line.<Leader>pk[count]
- replace the current line with the line[count]
lines above.<Leader>pj[count]
- replace the current line with the line[count]
lines below.<Leader>sk[count]
- swap the current line and the line[count]
lines above.<Leader>sj[count]
- swap the current line and the line[count]
lines down.