diff --git a/config/nvim/lua/keymaps.lua b/config/nvim/lua/keymaps.lua index 4b60ee2..2c55730 100644 --- a/config/nvim/lua/keymaps.lua +++ b/config/nvim/lua/keymaps.lua @@ -1,4 +1,4 @@ --- vim: set ft=lua ts=2 sw=2 tw=0 et cc=120 : +-- vim: set ft=lua ts=2 sw=2 tw=0 et cc=130 : require 'utils' @@ -54,6 +54,12 @@ K.nl('as', ':silent TestSuite', 'Test Suite') K.nl('al', ':silent TestLast', 'Test Last') K.nl('av', ':silent TestVisit', 'Test Visit') +-- ── PHPActor Operations ───────────────────────────────────────────── +K.nl('apm', ':PhpactorContextMenu', 'PHPactor: Context Menu') +K.nl('apn', ':PhpactorClassNew', 'PHPactor: Class New') +K.nl('aps', ':PhpactorClassSearch', 'PHPactor: Class Search') +K.nl('apt', ':PhpactorTransform', 'PHPactor: Transform') + -- ── Buffer operations ─────────────────────────────────────────────── -- Mappings for buffer management operations like switching, deleting, etc. -- Convention: All mappings start with 'b' followed by the operation @@ -69,25 +75,26 @@ K.nl('bw', ':lua MiniBufremove.wipeout()', 'Wipeout') -- Mappings for code and LSP operations like code actions, formatting, etc. -- Convention: All mappings start with 'c' followed by the operation -- unless it's a generic operation like signature help or hover + +local b = function() return require 'telescope.builtin' end +local lws = function() return b().lsp_workspace_symbols() end +local ldws = function() return b().lsp_dynamic_workspace_symbols() end + K.n('', ':lua vim.lsp.buf.signature_help()', { desc = 'Signature' }) -K.n('K', ':Lspsaga hover_doc', { desc = 'Hover Documentation' }) -K.ld('ca', 'n', ':Lspsaga code_action', 'Code Action') -K.ld('cci', 'n', ':Lspsaga incoming_calls', 'Incoming Calls') -K.ld('cco', 'n', ':Lspsaga outgoing_calls', 'Outgoing Calls') -K.ld('cd', 'n', ':Lspsaga show_line_diagnostics', 'Line Diagnostics') --- K.ld('cf', { 'n', 'x' }, ':lua vim.lsp.buf.format()', 'Format') +K.n('K', ':lua vim.lsp.buf.hover()', { desc = 'Hover Documentation' }) +K.ld('ca', 'n', ':lua vim.lsp.buf.code_action()', 'Code Action') +K.ld('cci', 'n', function() b().lsp_incoming_calls() end, 'Incoming calls') +K.ld('cco', 'n', function() b().lsp_outgoing_calls() end, 'Outgoing calls') +K.ld('cd', 'n', function() b().lsp_definitions() end, 'Definitions') +K.ld('cf', { 'n', 'x' }, ':lua vim.lsp.buf.format()', 'Format') K.ld('cg', 'n', ':lua require("neogen").generate()', 'Generate annotations') -K.ld('ci', 'n', ':Lspsaga implement', 'Implementations') -K.ld('cl', 'n', ':Lspsaga show_cursor_diagnostics', 'Cursor Diagnostics') -K.ld('cp', 'n', ':Lspsaga peek_definition', 'Peek Definition') -K.ld('cr', 'n', ':Lspsaga rename', 'Rename') -K.ld('cR', 'n', ':Lspsaga rename ++project', 'Rename Project wide') +K.ld('ci', 'n', function() b().lsp_implementations() end, 'Implementations') +K.ld('cp', 'n', function() b().lsp_type_definitions() end, 'Type Definition') +K.ld('cr', 'n', vim.lsp.buf.rename, 'Rename') K.ld('cs', 'n', ':Telescope lsp_document_symbols', 'LSP Document Symbols') -K.ld('ct', 'n', ':Lspsaga peek_type_definition', 'Peek Type Definition') -K.ld('cT', 'n', ':Telescope lsp_type_definitions', 'LSP Type Definitions') -K.ld('cu', 'n', ':Lspsaga preview_definition', 'Preview Definition') -K.ld('cv', 'n', ':Lspsaga diagnostic_jump_prev', 'Diagnostic Jump Prev') -K.ld('cw', 'n', ':Lspsaga diagnostic_jump_next', 'Diagnostic Jump Next') +K.ld('ct', 'n', function() b().treesitter() end, 'treesitter') +K.ld('cws', 'n', function() lws() end, 'Workspace Symbols') +K.ld('cwd', 'n', function() ldws() end, 'Dynamic Workspace Symbols') -- ── CommentBox operations ─────────────────────────────────────────── -- Mappings for creating and managing comment boxes @@ -102,25 +109,23 @@ K.nl('cbt', 'CBllline', 'CB: Titled Line') -- Mappings for Telescope operations like finding files, buffers, etc. -- Convention: All mappings start with 's' followed by the operation -- unless it's a generic operation like searching or finding buffers + +local fuzzy_search = function() + require('telescope.builtin').find_files( + require('telescope.themes').get_dropdown { + winblend = 20, + previewer = true, + } + ) +end + +local lazy_plugins = function() + return require('telescope').extensions.lazy_plugins.lazy_plugins() +end + K.nl('f', ':Telescope fd --hidden=true', 'Find Files') K.nl(',', ':Telescope buffers', 'Find existing buffers') -K.nl( - '/', - function() - require('telescope.builtin').current_buffer_fuzzy_find( - require('telescope.themes').get_dropdown { - winblend = 20, - previewer = true, - } - ) - end, - 'Fuzzily search in current buffer' -) - -K.nl('pm', ':PhpactorContextMenu', 'PHPactor: Context Menu') -K.nl('pn', ':PhpactorClassNew', 'PHPactor: Class New') -K.nl('ps', ':PhpactorClassSearch', 'PHPactor: Class Search') -K.nl('pt', ':PhpactorTransform', 'PHPactor: Transform') +K.nl('/', function() fuzzy_search() end, 'Fuzzily search in current buffer') K.nl('sc', ':Telescope commands', 'Commands') K.nl('sd', ':Telescope diagnostics', 'Search Diagnostics') @@ -129,11 +134,7 @@ K.nl('sh', ':Telescope help_tags', 'Help tags') K.nl('sk', ':Telescope keymaps', 'Search Keymaps') K.nl('sl', ':Telescope luasnip', 'Search LuaSnip') K.nl('so', ':Telescope oldfiles', 'Old Files') -K.nl( - 'sp', - ':lua require("telescope").extensions.lazy_plugins.lazy_plugins()', - 'Lazy Plugins' -) +K.nl('sp', function() lazy_plugins() end, 'Lazy Plugins') K.nl('sq', ':Telescope quickfix', 'Quickfix') K.nl('ss', ':Telescope treesitter', 'Treesitter') K.nl('sw', ':Telescope grep_string', 'Grep String') @@ -141,7 +142,7 @@ K.nl('sx', ':Telescope import', 'Telescope: Import') -- ── Trouble operations ────────────────────────────────────────────── -- Convention is 'x' followed by the operation -K.nl('xd', ':Trouble document_diagnostics', 'Document Diagnostics') +K.nl('xd', ':Trouble diagnostics', 'Document Diagnostics') K.nl('xl', ':Trouble loclist', 'Location List') K.nl('xq', ':Trouble quickfix', 'Quickfix') K.nl('xw', ':Trouble workspace_diagnostics', 'Workspace Diagnostics') diff --git a/config/nvim/lua/plugins/mini.lua b/config/nvim/lua/plugins/mini.lua index cf71753..43eb1ff 100644 --- a/config/nvim/lua/plugins/mini.lua +++ b/config/nvim/lua/plugins/mini.lua @@ -82,6 +82,7 @@ return { miniclue.gen_clues.registers(), miniclue.gen_clues.windows(), miniclue.gen_clues.z(), + { mode = 'n', keys = 'a', desc = '+Automation' }, { mode = 'n', keys = 'b', desc = '+Buffers' }, { mode = 'n', keys = 'c', desc = '+Code' }, { mode = 'n', keys = 'cb', desc = '+CommentBox' },