Created
February 7, 2025 15:33
-
-
Save BobToninho/5b05fcd330563392bdda08052a95f0dc to your computer and use it in GitHub Desktop.
Move lines by pressing Option+J/K
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Move lines easily {{{ | |
-- From https://vim.fandom.com/wiki/Moving_lines_up_or_down. Strange charachters are due to MacOS | |
-- ∆ = A-j | |
-- ˚ = A-k | |
vim.keymap.set("n", "∆", "<cmd>m .+1<CR>==") | |
vim.keymap.set("n", "˚", "<cmd>m .-2<CR>==") | |
vim.keymap.set("i", "∆", "<ESC><cmd>m .+1<CR>==gi") | |
vim.keymap.set("i", "˚", "<ESC><cmd>m .-2<CR>==gi") | |
-- using <cmd>m does not work with this | |
vim.keymap.set("v", "∆", ":m '>+1<CR>gv=gv") | |
vim.keymap.set("v", "˚", ":m '<-2<CR>gv=gv") | |
-- }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment