From 5bc29f77a48b8e46513c982362a55884e7f65238 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 8 Jul 2024 13:42:25 +0300 Subject: Neovim: worked more on completions, and changed a few other things in keymaps and options --- .config/nvim/lua/keymaps.lua | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to '.config/nvim/lua/keymaps.lua') diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua index 6772f0f..a48679e 100644 --- a/.config/nvim/lua/keymaps.lua +++ b/.config/nvim/lua/keymaps.lua @@ -1,18 +1,26 @@ local set = vim.keymap.set local silent = { silent = true } +---@param mode string|table +---@param keymap string +local function unbind(mode, keymap) + set(mode, keymap, function() end) +end -- Misc set({ 'n', 'i' }, '', 'ggVG', { desc = 'Visually Highlight [A]ll' }) -set('n', '', ':nohlsearch', silent) -set({ 'i', 'c' }, '', '+') +set('n', '', 'nohlsearch', silent) +set({ 'i', 'c' }, '', function() + vim.fn.getreg('+') +end) set('n', 'z', function() vim.cmd('Neotree close') vim.cmd('Trouble todo close') vim.cmd('UndotreeHide') end, { desc = '[Z]en Mode', silent = true }) +unbind({ 'i', 'n', 'v' }, '') -set('n', 'U', ':redo') -set('i', '', ':undo') +set('n', 'U', 'redo') +set('i', '', 'undo') -- Window Navigation set('n', '', '', { desc = 'Move focus to the left window' }) @@ -22,10 +30,10 @@ set('n', '', '', { desc = 'Move focus to the right window' }) -- Window resizing local resize = 2 -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' }) +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') -- Execute lua file or line set('n', 'x', '.lua', { desc = 'Execute the current line' }) set('n', 'x', 'source %', { desc = 'Execute the current file' }) + +print('Sourced keymaps.lua') -- cgit v1.3.1