diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 3f272f3..1b7561a 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -31,10 +31,10 @@ vim.keymap.set('n', '', 'echo "Use k to move!!"') vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Resize windows -vim.keymap.set('n', '', 'resize +2', { desc = 'Increase Window Height' }) -vim.keymap.set('n', '', 'resize -2', { desc = 'Decrease Window Height' }) -vim.keymap.set('n', '', 'vertical resize -2', { desc = 'Decrease Window Width' }) -vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Increase Window Width' }) +vim.keymap.set('n', '', 'wincmd 15 >', { desc = 'Increase window width' }) +vim.keymap.set('n', '', 'wincmd 15 <', { desc = 'Decrease window width' }) +vim.keymap.set('n', '', 'wincmd 5 +', { desc = 'Increase window height' }) +vim.keymap.set('n', '', 'wincmd 5 -', { desc = 'Decrease window height' }) vim.keymap.set('n', '', 'wincmd =', { desc = 'Set height/width equal' }) -- Keybinds to make split navigation easier. @@ -46,35 +46,18 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) --- Move Lines -vim.keymap.set('n', '', 'm .+1==', { desc = 'Move Down' }) -vim.keymap.set('n', '', 'm .-2==', { desc = 'Move Up' }) -vim.keymap.set('i', '', 'm .+1==gi', { desc = 'Move Down' }) -vim.keymap.set('i', '', 'm .-2==gi', { desc = 'Move Up' }) -vim.keymap.set('v', '', ":m '>+1gv=gv", { desc = 'Move Down' }) -vim.keymap.set('v', '', ":m '<-2gv=gv", { desc = 'Move Up' }) +-- Normal-mode commands +vim.keymap.set('n', '', 'MoveLine(1)') +vim.keymap.set('n', '', 'MoveLine(-1)') +vim.keymap.set('n', '', 'MoveHChar(-1)') +vim.keymap.set('n', '', 'MoveHChar(1)') +vim.keymap.set('n', 'wf', 'MoveWord(1)') +vim.keymap.set('n', 'wb', 'MoveWord(-1)') --- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n -vim.keymap.set('n', 'n', "'Nn'[v:searchforward].'zv'", { expr = true, desc = 'Next Search Result' }) -vim.keymap.set('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next Search Result' }) -vim.keymap.set('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next Search Result' }) -vim.keymap.set('n', 'N', "'nN'[v:searchforward].'zv'", { expr = true, desc = 'Prev Search Result' }) -vim.keymap.set('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev Search Result' }) -vim.keymap.set('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev Search Result' }) - --- Buffers -vim.keymap.set('n', '', 'bprevious', { desc = 'Prev Buffer' }) -vim.keymap.set('n', '', 'bnext', { desc = 'Next Buffer' }) -vim.keymap.set('n', 'bb', 'e #', { desc = 'Switch to Other Buffer' }) -vim.keymap.set('n', 'bD', ':bd', { desc = 'Delete Buffer and Window' }) - --- Tabs -vim.keymap.set('n', 'l', 'tablast', { desc = 'Last Tab' }) -vim.keymap.set('n', 'o', 'tabonly', { desc = 'Close Other Tabs' }) -vim.keymap.set('n', 'f', 'tabfirst', { desc = 'First Tab' }) -vim.keymap.set('n', '', 'tabnew', { desc = 'New Tab' }) -vim.keymap.set('n', 'd', 'tabclose', { desc = 'Close Tab' }) -vim.keymap.set('n', ']', 'tabnext', { desc = 'Next Tab' }) -vim.keymap.set('n', '[', 'tabprevious', { desc = 'Previous Tab' }) +-- Visual-mode commands +vim.keymap.set('v', '', 'MoveBlock(1)') +vim.keymap.set('v', '', 'MoveBlock(-1)') +vim.keymap.set('v', '', 'MoveHBlock(-1)') +vim.keymap.set('v', '', 'MoveHBlock(1)') -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index 4e0cfd0..daf934a 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -16,6 +16,9 @@ require('lazy').setup({ -- Remember position { 'vladdoster/remember.nvim', opts = {} }, + -- Move lines + { 'fedepujol/move.nvim', opts = { noremap = true, silent = true } }, + -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following -- keys can be used to configure plugin behavior/loading/etc.