diff --git a/lua/custom/maps/init.lua b/lua/custom/maps/init.lua index 5b0cae6..b1b0ded 100644 --- a/lua/custom/maps/init.lua +++ b/lua/custom/maps/init.lua @@ -27,8 +27,8 @@ vim.keymap.set({ 'v', 'n' }, 'zj', '', { desc = 'move and scroll down' }) -- go to beginning and end in insert mode vim.keymap.set('i', '', '^i', { desc = 'Go to the start of the line' }) vim.keymap.set('i', '', '', { desc = 'Go to the end of the line' }) -vim.keymap.set('i', '', 'wa', { desc = 'Go a word further' }) -vim.keymap.set('i', '', 'ba', { desc = 'Go a word backward' }) +vim.keymap.set('i', '', 'wi', { desc = 'Go a word further' }) +vim.keymap.set('i', '', 'bi', { desc = 'Go a word backward' }) -- navigate hjkl in insert mode vim.keymap.set('i', '', '', { desc = 'Move left' }) @@ -36,6 +36,20 @@ vim.keymap.set('i', '', '', { desc = 'Move right' }) vim.keymap.set('i', '', '', { desc = 'Move down' }) vim.keymap.set('i', '', '', { desc = 'Move up' }) +-- move to window +-- See `:help wincmd` for a list of all window commands +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +-- diagnostics +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) + +-- let me out!!! +vim.keymap.set({ 'n', 'v' }, 'qq', 'q!', { desc = '[Q]uit the current window' }) + -------------------------------------------------------------------------------- -- Workspace, buffer and window manipulation -------------------------------------------------------------------------------- @@ -59,20 +73,6 @@ vim.keymap.set('n', 'wj', 'tabprevious', { desc = 'Last [W]orks vim.keymap.set('t', '', vim.api.nvim_replace_termcodes('', true, true, true), { desc = 'Leave terminal mode' }) --------------------------------------------------------------------------------- --- Move to things --------------------------------------------------------------------------------- --- move to window --- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - --- diagnostics -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) - -------------------------------------------------------------------------------- -- Editing -------------------------------------------------------------------------------- diff --git a/lua/custom/plugins/editing.lua b/lua/custom/plugins/editing.lua index a876f6b..7b152de 100644 --- a/lua/custom/plugins/editing.lua +++ b/lua/custom/plugins/editing.lua @@ -13,9 +13,19 @@ return { function() require('Comment.api').toggle.linewise.current() end, - mode = { 'n', 'v' }, + mode = { 'n' }, desc = 'Comment toggle current line', }, + { + 'v', + function() + local esc = vim.api.nvim_replace_termcodes('', true, false, true) + vim.api.nvim_feedkeys(esc, 'nx', false) + require('Comment.api').toggle.linewise(vim.fn.visualmode()) + end, + mode = { 'x' }, + desc = 'Comment toggle selected lines', + }, }, config = function(_, opts) vim.keymap.set('n', 'c', function() @@ -59,4 +69,17 @@ return { require('icon-picker').setup { disable_legacy_commands = true } end, }, + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require('nvim-autopairs').setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require 'nvim-autopairs.completion.cmp' + local cmp = require 'cmp' + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, + }, } diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 435f7ce..5959960 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -157,16 +157,16 @@ return { -- -- will move you to the right of each of the expansion locations. -- is similar, except moving you backwards. - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), + --[''] = cmp.mapping(function() + -- if luasnip.expand_or_locally_jumpable() then + -- luasnip.expand_or_jump() + -- end + --end, { 'i', 's' }), + --[''] = cmp.mapping(function() + -- if luasnip.locally_jumpable(-1) then + -- luasnip.jump(-1) + -- end + --end, { 'i', 's' }), -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps