Neat key bindings for vim/neovim to move selected lines up and down in visual mode:

neovim:
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")

vim:
vmap J :m '>+1<CR>gv=gv
vmap K :m '<-2<CR>gv=gv

Thanks to ThePrimeagen for this gem.

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.bsd.cafe/users/vkarlsen/statuses/114608356958266886 on your instance and quote it. (Note that quoting is not supported in Mastodon.)