1
0

FEAT: Move lines around more easily in 3 different modes using alt-j and

alt-k
This commit is contained in:
Nigel Barink 2024-03-26 17:48:06 +01:00
parent 85f3ba3d71
commit 5b3ec85c91
Signed by: Nigel
GPG Key ID: 6893A31C2D84A9D2

View File

@ -14,3 +14,12 @@ elseif osname == "Linux" then
-- Linux only!!
vim.keymap.set('n', '<leader>x', "<cmd>!chmod +x %<CR>", { silent = true })
end
-- Move lines while in visual mode
vim.keymap.set('v', '<A-j>', ':m \'>+1<CR>gv=gv', {noremap = true})
vim.keymap.set('v', '<A-k>', ':m \'<-2<CR>gv=gv', {noremap = true})
-- Move lines while in normal mode
vim.keymap.set('n', '<A-j>', ':m .+1<CR>==', {noremap = true})
vim.keymap.set('n', '<A-k>', ':m .-2<CR>==', {noremap = true})
-- Move line in edit mode
vim.keymap.set('i', '<A-j>', ':m .+1<CR>==gi', {noremap = true})
vim.keymap.set('i', '<A-k>', ':m .-2<CR>==gi', {noremap = true})