nvim: keymappings: Add mappings to move lines

This commit is contained in:
Sanchayan Maity 2021-07-19 18:04:20 +05:30
parent c646381a00
commit cc2bedbe5d
1 changed files with 8 additions and 0 deletions

View File

@ -128,6 +128,14 @@ remap('n', 'g<C-v>', '`[v`]', { noremap = true })
-- Map ;; to :
remap('n', ';;', ':', { noremap = true })
-- https://vim.fandom.com/wiki/Moving_lines_up_or_down
remap('n', '<A-j>', ':m .+1<CR>==', { noremap = true, silent = true })
remap('n', '<A-k>', ':m .-2<CR>==', { noremap = true, silent = true })
remap('i', '<A-j>', '<ESC>:m .+1<CR>==gi', { noremap = true, silent = true })
remap('i', '<A-k>', '<ESC>:m .-2<CR>==gi', { noremap = true, silent = true })
remap('v', '<A-j>', ':m \'>+1<CR>gv=gv', { noremap = true, silent = true })
remap('v', '<A-k>', ':m \'<-2<CR>gv=gv', { noremap = true, silent = true })
-- Marks
-- '0 - Position of cursor when last exited Vim.
-- '" - Position of cursor when last exited the current buffer.