diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index 20ffa9fb..05a76ee0 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -58,3 +58,8 @@ vim.keymap.set('n', 'c', 'bdelete', { desc = '[c]lose file' }) -- Add a keymap for delete while on insert-mode -- this works well with , , vim.keymap.set('i', '', '') + +-- [[ Keymap Deletion ]] + +-- this would be remapped to `grs` so I don't want to keep it. +vim.keymap.del('n', 'gO') diff --git a/lua/plugins/fzf-lua.lua b/lua/plugins/fzf-lua.lua index 60f58df9..0eb986e9 100644 --- a/lua/plugins/fzf-lua.lua +++ b/lua/plugins/fzf-lua.lua @@ -56,16 +56,56 @@ return { vim.keymap.set('n', 'Gw', fl.git_worktrees, { desc = 'Git: worktrees' }) -- LSP specific - vim.keymap.set({ 'n', 'v' }, 'la', fl.lsp_code_actions, { desc = 'LSP: code actions' }) - vim.keymap.set({ 'n', 'v' }, 'lD', fl.lsp_declarations, { desc = 'LSP: declaration' }) - vim.keymap.set({ 'n', 'v' }, 'ld', fl.lsp_definitions, { desc = 'LSP: definition' }) - vim.keymap.set({ 'n', 'v' }, 'li', fl.lsp_implementations, { desc = 'LSP: implementations' }) - vim.keymap.set({ 'n', 'v' }, 'lI', fl.lsp_incoming_calls, { desc = 'LSP: incoming calls' }) - vim.keymap.set({ 'n', 'v' }, 'lO', fl.lsp_outgoing_calls, { desc = 'LSP: outgoing calls' }) - vim.keymap.set({ 'n', 'v' }, 'lr', fl.lsp_references, { desc = 'LSP: references' }) - vim.keymap.set('n', 'ls', fl.lsp_document_symbols, { desc = 'LSP: symbols - current buf' }) - vim.keymap.set('n', 'lw', fl.lsp_workspace_symbols, { desc = 'LSP: symbols - workspace' }) - vim.keymap.set({ 'n', 'v' }, 'lt', fl.lsp_typedefs, { desc = 'LSP: type definition' }) + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('fzflua-lsp-attach', { clear = true }), + callback = function(event) + local buf = event.buf + + -- `gr` keymap style + vim.keymap.set({ 'n', 'v' }, 'gra', fl.lsp_code_actions, { buffer = buf, desc = 'LSP: code actions' }) + vim.keymap.set({ 'n', 'v' }, 'grD', fl.lsp_declarations, { buffer = buf, desc = 'LSP: declaration' }) + vim.keymap.set({ 'n', 'v' }, 'grd', fl.lsp_definitions, { buffer = buf, desc = 'LSP: definition' }) + vim.keymap.set({ 'n', 'v' }, 'gri', fl.lsp_implementations, { buffer = buf, desc = 'LSP: implementations' }) + vim.keymap.set({ 'n', 'v' }, 'grI', fl.lsp_incoming_calls, { buffer = buf, desc = 'LSP: incoming calls' }) + vim.keymap.set({ 'n', 'v' }, 'grO', fl.lsp_outgoing_calls, { buffer = buf, desc = 'LSP: outgoing calls' }) + vim.keymap.set({ 'n', 'v' }, 'grr', fl.lsp_references, { buffer = buf, desc = 'LSP: references' }) + vim.keymap.set('n', 'grs', fl.lsp_document_symbols, { buffer = buf, desc = 'LSP: symbols - current buf' }) + vim.keymap.set('n', 'grw', fl.lsp_workspace_symbols, { buffer = buf, desc = 'LSP: symbols - workspace' }) + vim.keymap.set({ 'n', 'v' }, 'grt', fl.lsp_typedefs, { buffer = buf, desc = 'LSP: type definition' }) + + -- my style + vim.keymap.set({ 'n', 'v' }, 'la', fl.lsp_code_actions, { buffer = buf, desc = 'LSP: code actions' }) + vim.keymap.set({ 'n', 'v' }, 'lD', fl.lsp_declarations, { buffer = buf, desc = 'LSP: declaration' }) + vim.keymap.set({ 'n', 'v' }, 'ld', fl.lsp_definitions, { buffer = buf, desc = 'LSP: definition' }) + vim.keymap.set( + { 'n', 'v' }, + 'li', + fl.lsp_implementations, + { buffer = buf, desc = 'LSP: implementations' } + ) + vim.keymap.set( + { 'n', 'v' }, + 'lI', + fl.lsp_incoming_calls, + { buffer = buf, desc = 'LSP: incoming calls' } + ) + vim.keymap.set( + { 'n', 'v' }, + 'lO', + fl.lsp_outgoing_calls, + { buffer = buf, desc = 'LSP: outgoing calls' } + ) + vim.keymap.set({ 'n', 'v' }, 'lr', fl.lsp_references, { buffer = buf, desc = 'LSP: references' }) + vim.keymap.set( + 'n', + 'ls', + fl.lsp_document_symbols, + { buffer = buf, desc = 'LSP: symbols - current buf' } + ) + vim.keymap.set('n', 'lw', fl.lsp_workspace_symbols, { buffer = buf, desc = 'LSP: symbols - workspace' }) + vim.keymap.set({ 'n', 'v' }, 'lt', fl.lsp_typedefs, { buffer = buf, desc = 'LSP: type definition' }) + end, + }) -- Diagnostic specific vim.keymap.set('n', 'dd', fl.diagnostics_document, { desc = 'List diagnostics - current buf' }) diff --git a/lua/plugins/telescope-undo.lua b/lua/plugins/telescope-undo.lua index d267eb44..96758d56 100644 --- a/lua/plugins/telescope-undo.lua +++ b/lua/plugins/telescope-undo.lua @@ -9,11 +9,11 @@ return { -- lazy = true, keys = { { -- lazy style key map - 'su', + 'fu', function() require('telescope').extensions.undo.undo() end, - desc = '[S]earch [U]ndo history', + desc = 'Undo history', }, }, opts = { diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 6072e36e..99909f9e 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -11,7 +11,8 @@ return { -- it’s best to remove the Telescope plugin config entirely -- instead of just disabling it here, to keep your config clean. enabled = true, - event = 'VimEnter', + -- event = 'VimEnter', + lazy = true, dependencies = { 'nvim-lua/plenary.nvim', { -- If encountering errors, see telescope-fzf-native README for installation instructions @@ -100,79 +101,79 @@ return { pcall(require('telescope').load_extension, 'ui-select') -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set({ 'n', 'v' }, 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', 'sc', builtin.commands, { desc = '[S]earch [C]ommands' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + -- local builtin = require 'telescope.builtin' + -- vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + -- vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + -- vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + -- vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + -- vim.keymap.set({ 'n', 'v' }, 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + -- vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + -- vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + -- vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + -- vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + -- vim.keymap.set('n', 'sc', builtin.commands, { desc = '[S]earch [C]ommands' }) + -- vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info, - -- it is better explained there). This allows easily switching between pickers if you prefer using something else! - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }), - callback = function(event) - local buf = event.buf + -- -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info, + -- -- it is better explained there). This allows easily switching between pickers if you prefer using something else! + -- vim.api.nvim_create_autocmd('LspAttach', { + -- group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }), + -- callback = function(event) + -- local buf = event.buf - -- Find references for the word under your cursor. - vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' }) + -- -- Find references for the word under your cursor. + -- vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' }) - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' }) + -- -- Jump to the implementation of the word under your cursor. + -- -- Useful when your language has ways of declaring types without an actual implementation. + -- vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' }) - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' }) + -- -- Jump to the definition of the word under your cursor. + -- -- This is where a variable was first declared, or where a function is defined, etc. + -- -- To jump back, press . + -- vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' }) - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' }) + -- -- Fuzzy find all the symbols in your current document. + -- -- Symbols are things like variables, functions, types, etc. + -- vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' }) - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - vim.keymap.set( - 'n', - 'gW', - builtin.lsp_dynamic_workspace_symbols, - { buffer = buf, desc = 'Open Workspace Symbols' } - ) + -- -- Fuzzy find all the symbols in your current workspace. + -- -- Similar to document symbols, except searches over your entire project. + -- vim.keymap.set( + -- 'n', + -- 'gW', + -- builtin.lsp_dynamic_workspace_symbols, + -- { buffer = buf, desc = 'Open Workspace Symbols' } + -- ) - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' }) - end, - }) + -- -- Jump to the type of the word under your cursor. + -- -- Useful when you're not sure what type a variable is and you want to see + -- -- the definition of its *type*, not where it was *defined*. + -- vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' }) + -- end, + -- }) - -- Override default behavior and theme when searching - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) + -- -- Override default behavior and theme when searching + -- vim.keymap.set('n', '/', function() + -- -- You can pass additional configuration to Telescope to change the theme, layout, etc. + -- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + -- winblend = 10, + -- previewer = false, + -- }) + -- end, { desc = '[/] Fuzzily search in current buffer' }) - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) + -- -- It's also possible to pass additional configuration options. + -- -- See `:help telescope.builtin.live_grep()` for information about particular keys + -- vim.keymap.set('n', 's/', function() + -- builtin.live_grep { + -- grep_open_files = true, + -- prompt_title = 'Live Grep in Open Files', + -- } + -- end, { desc = '[S]earch [/] in Open Files' }) - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) + -- -- Shortcut for searching your Neovim configuration files + -- vim.keymap.set('n', 'sn', function() + -- builtin.find_files { cwd = vim.fn.stdpath 'config' } + -- end, { desc = '[S]earch [N]eovim files' }) end, }