From 39d19909525940cc16695ad3e7fcdb5812f744ac Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 6 Jul 2024 20:07:41 +0300 Subject: Neovim: started rework on the conifg, changed a bunch of stuff --- .config/nvim/lua/keymaps.lua | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to '.config/nvim/lua/keymaps.lua') diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua index e8e2b29..f6d67ec 100644 --- a/.config/nvim/lua/keymaps.lua +++ b/.config/nvim/lua/keymaps.lua @@ -1,29 +1,35 @@ +local set = vim.keymap.set +local silent = { silent = true } + -- Misc -vim.keymap.set({ 'n', 'i' }, '', 'ggVG', { desc = 'Visually Highlight [A]ll' }) -vim.keymap.set('n', '', ':nohlsearch') -vim.keymap.set('n', 'z', function() +set({ 'n', 'i' }, '', 'ggVG', { desc = 'Visually Highlight [A]ll' }) +set('n', '', ':nohlsearch', silent) +set({ 'i', 'c' }, '', '+') +set('n', 'z', function() vim.cmd('Neotree close') vim.cmd('Trouble todo close') -end, { desc = '[Z]en Mode' }) -vim.keymap.set({ 'i', 'c' }, '', '+') +end, { desc = '[Z]en Mode', silent = true }) --- Undo/Redo -vim.keymap.set('n', 'U', ':redo') -vim.keymap.set('i', '', ':undo') +set('n', 'U', ':redo') +set('i', '', ':undo') -- Window Navigation -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the down window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the up window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +set('n', '', '', { desc = 'Move focus to the left window' }) +set('n', '', '', { desc = 'Move focus to the down window' }) +set('n', '', '', { desc = 'Move focus to the up window' }) +set('n', '', '', { desc = 'Move focus to the right window' }) -- Window resizing local resize = 2 -vim.keymap.set({ 'n', 't' }, '', string.format(':vertical resize -%d', resize), { desc = 'Resize Left' }) -vim.keymap.set({ 'n', 't' }, '', string.format(':resize -%d', resize), { desc = 'Resize Up' }) -vim.keymap.set({ 'n', 't' }, '', string.format(':resize +%d', resize), { desc = 'Resize Down' }) -vim.keymap.set({ 'n', 't' }, '', string.format(':vertical resize +%d', resize), { desc = 'Resize Right' }) +set({ 'n', 't' }, '', string.format(':vertical resize -%d', resize), { desc = 'Resize Left' }) +set({ 'n', 't' }, '', string.format(':resize -%d', resize), { desc = 'Resize Up' }) +set({ 'n', 't' }, '', string.format(':resize +%d', resize), { desc = 'Resize Down' }) +set({ 'n', 't' }, '', string.format(':vertical resize +%d', resize), { desc = 'Resize Right' }) + +-- Keep selection after < and > in visual mode +set('v', '<', '', '>gv') --- Keep selection after < and > -vim.keymap.set('v', '<', '', '>gv', {}) +-- Execute lua file or line +set('n', 'x', '.lua', { desc = 'Execute the current line' }) +set('n', 'x', 'source %', { desc = 'Execute the current file' }) -- cgit v1.3.1