From 600f7e03b030d787e539f5f3bd093d6e72884ea6 Mon Sep 17 00:00:00 2001 From: dunix241 Date: Fri, 1 Nov 2024 13:43:53 +0700 Subject: [PATCH] feat(keymaps): allow more dynamic keymaps structure for ease of modularization This commit is for encouraging modularization and facilitate ease of use **Simplify Keymap Configuration** Previously, users had to specify the entire keymap structure to modify key mappings. For example: ```lua { keymaps = { window = { window_left = "keys1", window_lower = "keys2" }, resize_window = { size_increase_height = "keys3" } }, } ``` Now, users can still specify the structure for better organization, but they can directly specify the key mappings without needing to follow the nested structure. The new approach allows for more flexibility and simplicity: ```lua { window_left = "keys1", size_increase_height = "keys3" } ``` Additionally, users can group keys into tables for better organization if desired: ```lua { { window_left = "keys1", window_lower = "keys2" } } ``` This change ensures that only the `keys = "keys"` mappings matter, making the configuration process more straightforward and user-friendly. --- lua/lazyvim/config/keymaps.lua | 146 +- lua/lazyvim/keymaps.lua | 1317 +++++++++-------- lua/lazyvim/plugins/coding.lua | 30 +- lua/lazyvim/plugins/editor.lua | 139 +- .../plugins/extras/coding/copilot-chat.lua | 16 +- lua/lazyvim/plugins/extras/coding/luasnip.lua | 8 +- .../plugins/extras/coding/mini-surround.lua | 16 +- lua/lazyvim/plugins/extras/coding/yanky.lua | 48 +- lua/lazyvim/plugins/extras/dap/core.lua | 42 +- lua/lazyvim/plugins/extras/editor/aerial.lua | 10 +- lua/lazyvim/plugins/extras/editor/dial.lua | 8 +- lua/lazyvim/plugins/extras/editor/fzf.lua | 105 +- .../plugins/extras/editor/harpoon2.lua | 2 +- .../plugins/extras/editor/illuminate.lua | 14 +- .../plugins/extras/editor/inc-rename.lua | 4 +- lua/lazyvim/plugins/extras/editor/leap.lua | 32 +- .../plugins/extras/editor/mini-diff.lua | 4 +- .../plugins/extras/editor/mini-files.lua | 6 +- lua/lazyvim/plugins/extras/editor/outline.lua | 11 +- .../plugins/extras/editor/overseer.lua | 18 +- .../plugins/extras/editor/refactoring.lua | 26 +- .../plugins/extras/editor/telescope.lua | 121 +- lua/lazyvim/plugins/extras/lang/ansible.lua | 2 +- lua/lazyvim/plugins/extras/lang/clangd.lua | 9 +- lua/lazyvim/plugins/extras/lang/clojure.lua | 6 +- lua/lazyvim/plugins/extras/lang/elixir.lua | 6 +- lua/lazyvim/plugins/extras/lang/java.lua | 32 +- lua/lazyvim/plugins/extras/lang/lean.lua | 4 +- lua/lazyvim/plugins/extras/lang/markdown.lua | 4 +- lua/lazyvim/plugins/extras/lang/omnisharp.lua | 4 +- lua/lazyvim/plugins/extras/lang/python.lua | 12 +- lua/lazyvim/plugins/extras/lang/r.lua | 32 +- lua/lazyvim/plugins/extras/lang/rust.lua | 8 +- lua/lazyvim/plugins/extras/lang/scala.lua | 6 +- lua/lazyvim/plugins/extras/lang/sql.lua | 4 +- lua/lazyvim/plugins/extras/lang/svelte.lua | 4 +- lua/lazyvim/plugins/extras/lang/tex.lua | 6 +- .../plugins/extras/lang/typescript.lua | 16 +- lua/lazyvim/plugins/extras/test/core.lua | 24 +- lua/lazyvim/plugins/extras/ui/alpha.lua | 20 +- lua/lazyvim/plugins/extras/ui/edgy.lua | 15 +- .../plugins/extras/ui/mini-animate.lua | 4 +- .../plugins/extras/ui/treesitter-context.lua | 4 +- lua/lazyvim/plugins/extras/util/chezmoi.lua | 10 +- lua/lazyvim/plugins/extras/util/gitui.lua | 6 +- lua/lazyvim/plugins/extras/util/octo.lua | 32 +- lua/lazyvim/plugins/extras/util/project.lua | 11 +- lua/lazyvim/plugins/extras/util/rest.lua | 16 +- lua/lazyvim/plugins/extras/vscode.lua | 8 +- lua/lazyvim/plugins/formatting.lua | 4 +- lua/lazyvim/plugins/lsp/init.lua | 4 +- lua/lazyvim/plugins/lsp/keymaps.lua | 46 +- lua/lazyvim/plugins/treesitter.lua | 43 +- lua/lazyvim/plugins/ui.lua | 66 +- lua/lazyvim/plugins/util.lua | 10 +- lua/lazyvim/util/mini.lua | 4 +- 56 files changed, 1327 insertions(+), 1278 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 5f3edd06..ad8549f2 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -3,7 +3,7 @@ -- DO NOT USE `LazyVim.safe_keymap_set` IN YOUR OWN CONFIG!! -- use `vim.keymap.set` instead local map = LazyVim.safe_keymap_set -local k = require("lazyvim.keymaps").get_keymaps().keymaps +local k = require("lazyvim.keymaps").get_keymaps() -- better up/down map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) @@ -12,34 +12,34 @@ map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) -- Move to window using the hjkl keys -map("n", k.window.left, "h", { desc = "Go to Left Window", remap = true }) -map("n", k.window.lower, "j", { desc = "Go to Lower Window", remap = true }) -map("n", k.window.upper, "k", { desc = "Go to Upper Window", remap = true }) -map("n", k.window.right, "l", { desc = "Go to Right Window", remap = true }) +map("n", k.window_left, "h", { desc = "Go to Left Window", remap = true }) +map("n", k.window_lower, "j", { desc = "Go to Lower Window", remap = true }) +map("n", k.window_upper, "k", { desc = "Go to Upper Window", remap = true }) +map("n", k.window_right, "l", { desc = "Go to Right Window", remap = true }) -- Resize window using arrow keys -map("n", k.resize_window.increase_height, "resize +2", { desc = "Increase Window Height" }) -map("n", k.resize_window.decrease_height, "resize -2", { desc = "Decrease Window Height" }) -map("n", k.resize_window.decrease_width, "vertical resize -2", { desc = "Decrease Window Width" }) -map("n", k.resize_window.increase_width, "vertical resize +2", { desc = "Increase Window Width" }) +map("n", k.size_increase_height, "resize +2", { desc = "Increase Window Height" }) +map("n", k.size_decrease_height, "resize -2", { desc = "Decrease Window Height" }) +map("n", k.size_decrease_width, "vertical resize -2", { desc = "Decrease Window Width" }) +map("n", k.size_increase_width, "vertical resize +2", { desc = "Increase Window Width" }) -- Move Lines -map("n", k.move_lines.down, "execute 'move .+' . v:count1==", { desc = "Move Down" }) -map("n", k.move_lines.up, "execute 'move .-' . (v:count1 + 1)==", { desc = "Move Up" }) -map("i", k.move_lines.down, "m .+1==gi", { desc = "Move Down" }) -map("i", k.move_lines.up, "m .-2==gi", { desc = "Move Up" }) -map("v", k.move_lines.down, ":execute \"'<,'>move '>+\" . v:count1gv=gv", { desc = "Move Down" }) -map("v", k.move_lines.up, ":execute \"'<,'>move '<-\" . (v:count1 + 1)gv=gv", { desc = "Move Up" }) +map("n", k.move_down, "execute 'move .+' . v:count1==", { desc = "Move Down" }) +map("n", k.move_up, "execute 'move .-' . (v:count1 + 1)==", { desc = "Move Up" }) +map("i", k.move_down, "m .+1==gi", { desc = "Move Down" }) +map("i", k.move_up, "m .-2==gi", { desc = "Move Up" }) +map("v", k.move_down, ":execute \"'<,'>move '>+\" . v:count1gv=gv", { desc = "Move Down" }) +map("v", k.move_up, ":execute \"'<,'>move '<-\" . (v:count1 + 1)gv=gv", { desc = "Move Up" }) -- buffers -map("n", k.buffers.prev, "bprevious", { desc = "Prev Buffer" }) -map("n", k.buffers.next, "bnext", { desc = "Next Buffer" }) -map("n", k.buffers.prev_alt, "bprevious", { desc = "Prev Buffer" }) -map("n", k.buffers.next_alt, "bnext", { desc = "Next Buffer" }) -map("n", k.buffers.switch_to_other, "e #", { desc = "Switch to Other Buffer" }) -map("n", k.buffers.switch_to_other_alt, "e #", { desc = "Switch to Other Buffer" }) -map("n", k.buffers.delete, LazyVim.ui.bufremove, { desc = "Delete Buffer" }) -map("n", k.buffers.delete_and_close, ":bd", { desc = "Delete Buffer and Window" }) +map("n", k.buf_prev, "bprevious", { desc = "Prev Buffer" }) +map("n", k.buf_next, "bnext", { desc = "Next Buffer" }) +map("n", k.buf_prev_alt, "bprevious", { desc = "Prev Buffer" }) +map("n", k.buf_next_alt, "bnext", { desc = "Next Buffer" }) +map("n", k.buf_switch_to_other, "e #", { desc = "Switch to Other Buffer" }) +map("n", k.buf_switch_to_other_alt, "e #", { desc = "Switch to Other Buffer" }) +map("n", k.buf_delete, LazyVim.ui.bufremove, { desc = "Delete Buffer" }) +map("n", k.buf_delete_and_close, ":bd", { desc = "Delete Buffer and Window" }) -- Clear search with map({ "i", "n" }, "", "noh", { desc = "Escape and Clear hlsearch" }) @@ -77,8 +77,8 @@ map("v", "<", "", ">gv") -- commenting -map("n", k.commenting.add_comment_below, "oVcxnormal gccfxa", { desc = "Add Comment Below" }) -map("n", k.commenting.add_comment_above, "OVcxnormal gccfxa", { desc = "Add Comment Above" }) +map("n", k.comment_add_below, "oVcxnormal gccfxa", { desc = "Add Comment Below" }) +map("n", k.comment_add_above, "OVcxnormal gccfxa", { desc = "Add Comment Above" }) -- lazy map("n", k.lazy, "Lazy", { desc = "Lazy" }) @@ -105,46 +105,46 @@ local diagnostic_goto = function(next, severity) go({ severity = severity }) end end -map("n", k.diagnostics.line_diagnostics, vim.diagnostic.open_float, { desc = "Line Diagnostics" }) -map("n", k.diagnostics.next_diagnostic, diagnostic_goto(true), { desc = "Next Diagnostic" }) -map("n", k.diagnostics.prev_diagnostic, diagnostic_goto(false), { desc = "Prev Diagnostic" }) -map("n", k.diagnostics.next_error, diagnostic_goto(true, "ERROR"), { desc = "Next Error" }) -map("n", k.diagnostics.prev_error, diagnostic_goto(false, "ERROR"), { desc = "Prev Error" }) -map("n", k.diagnostics.next_warning, diagnostic_goto(true, "WARN"), { desc = "Next Warning" }) -map("n", k.diagnostics.prev_warning, diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) +map("n", k.diagnostic_line_diagnostics, vim.diagnostic.open_float, { desc = "Line Diagnostics" }) +map("n", k.diagnostic_next_diagnostic, diagnostic_goto(true), { desc = "Next Diagnostic" }) +map("n", k.diagnostic_prev_diagnostic, diagnostic_goto(false), { desc = "Prev Diagnostic" }) +map("n", k.diagnostic_next_error, diagnostic_goto(true, "ERROR"), { desc = "Next Error" }) +map("n", k.diagnostic_prev_error, diagnostic_goto(false, "ERROR"), { desc = "Prev Error" }) +map("n", k.diagnostic_next_warning, diagnostic_goto(true, "WARN"), { desc = "Next Warning" }) +map("n", k.diagnostic_prev_warning, diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) -- stylua: ignore start -- toggle options -LazyVim.toggle.map(k.toggle_options.auto_format_buffer, LazyVim.toggle.format()) -LazyVim.toggle.map(k.toggle_options.auto_format_global, LazyVim.toggle.format(true)) -LazyVim.toggle.map(k.toggle_options.spelling, LazyVim.toggle("spell", { name = "Spelling" })) -LazyVim.toggle.map(k.toggle_options.wrap, LazyVim.toggle("wrap", { name = "Wrap" })) -LazyVim.toggle.map(k.toggle_options.relativenumber, LazyVim.toggle("relativenumber", { name = "Relative Number" })) -LazyVim.toggle.map(k.toggle_options.diagnostics, LazyVim.toggle.diagnostics) -LazyVim.toggle.map(k.toggle_options.number, LazyVim.toggle.number) -LazyVim.toggle.map(k.toggle_options.conceallevel, LazyVim.toggle("conceallevel", { values = { 0, vim.o.conceallevel > 0 and vim.o.conceallevel or 2 } })) -LazyVim.toggle.map(k.toggle_options.treesitter, LazyVim.toggle.treesitter) -LazyVim.toggle.map(k.toggle_options.background, LazyVim.toggle("background", { values = { "light", "dark" }, name = "Background" })) +LazyVim.toggle.map(k.toggle_auto_format_buffer, LazyVim.toggle.format()) +LazyVim.toggle.map(k.toggle_auto_format_global, LazyVim.toggle.format(true)) +LazyVim.toggle.map(k.toggle_spelling, LazyVim.toggle("spell", { name = "Spelling" })) +LazyVim.toggle.map(k.toggle_wrap, LazyVim.toggle("wrap", { name = "Wrap" })) +LazyVim.toggle.map(k.toggle_relativenumber, LazyVim.toggle("relativenumber", { name = "Relative Number" })) +LazyVim.toggle.map(k.toggle_diagnostics, LazyVim.toggle.diagnostics) +LazyVim.toggle.map(k.toggle_number, LazyVim.toggle.number) +LazyVim.toggle.map(k.toggle_conceallevel, LazyVim.toggle("conceallevel", { values = { 0, vim.o.conceallevel > 0 and vim.o.conceallevel or 2 } })) +LazyVim.toggle.map(k.toggle_treesitter, LazyVim.toggle.treesitter) +LazyVim.toggle.map(k.toggle_background, LazyVim.toggle("background", { values = { "light", "dark" }, name = "Background" })) if vim.lsp.inlay_hint then - LazyVim.toggle.map(k.toggle_options.inlay_hints, LazyVim.toggle.inlay_hints) + LazyVim.toggle.map(k.toggle_inlay_hints, LazyVim.toggle.inlay_hints) end -- lazygit -map("n", k.lazygit.toggle_root, function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" }) -map("n", k.lazygit.toggle_cwd, function() LazyVim.lazygit() end, { desc = "Lazygit (cwd)" }) -map("n", k.lazygit.blame_line, LazyVim.lazygit.blame_line, { desc = "Git Blame Line" }) -map("n", k.lazygit.browse, LazyVim.lazygit.browse, { desc = "Git Browse" }) +map("n", k.lazygit_toggle_root, function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, { desc = "Lazygit (Root Dir)" }) +map("n", k.lazygit_toggle_cwd, function() LazyVim.lazygit() end, { desc = "Lazygit (cwd)" }) +map("n", k.lazygit_blame_line, LazyVim.lazygit.blame_line, { desc = "Git Blame Line" }) +map("n", k.lazygit_browse, LazyVim.lazygit.browse, { desc = "Git Browse" }) -map("n", k.lazygit.current_file_history, function() +map("n", k.lazygit_current_file_history, function() local git_path = vim.api.nvim_buf_get_name(0) LazyVim.lazygit({args = { "-f", vim.trim(git_path) }}) end, { desc = "Lazygit Current File History" }) -map("n", k.lazygit.git_log_root, function() +map("n", k.lazygit_git_log_root, function() LazyVim.lazygit({ args = { "log" }, cwd = LazyVim.root.git() }) end, { desc = "Lazygit Log" }) -map("n", k.lazygit.git_log_cwd, function() +map("n", k.lazygit_git_log_cwd, function() LazyVim.lazygit({ args = { "log" } }) end, { desc = "Lazygit Log (cwd)" }) @@ -160,32 +160,32 @@ map("n", k.lazyvim_changelog, function() LazyVim.news.changelog() end, { desc = -- floating terminal local lazyterm = function() LazyVim.terminal(nil, { cwd = LazyVim.root() }) end -map("n", k.terminal.floating_terminal.toggle_root, lazyterm, { desc = "Terminal (Root Dir)" }) -map("n", k.terminal.floating_terminal.toggle_cwd, function() LazyVim.terminal() end, { desc = "Terminal (cwd)" }) -map("n", k.terminal.floating_terminal.toggle_root_alt_1, lazyterm, { desc = "Terminal (Root Dir)" }) -map("n", k.terminal.floating_terminal.toggle_root_alt_2, lazyterm, { desc = "which_key_ignore" }) +map("n", k.terminal_toggle_root, lazyterm, { desc = "Terminal (Root Dir)" }) +map("n", k.terminal_toggle_cwd, function() LazyVim.terminal() end, { desc = "Terminal (cwd)" }) +map("n", k.terminal_toggle_root_alt_1, lazyterm, { desc = "Terminal (Root Dir)" }) +map("n", k.terminal_toggle_root_alt_2, lazyterm, { desc = "which_key_ignore" }) -- Terminal Mappings -map("t", k.terminal.enter_normal_mode, "", { desc = "Enter Normal Mode" }) -map("t", k.window.left, "wincmd h", { desc = "Go to Left Window" }) -map("t", k.window.lower, "wincmd j", { desc = "Go to Lower Window" }) -map("t", k.window.upper, "wincmd k", { desc = "Go to Upper Window" }) -map("t", k.window.right, "wincmd l", { desc = "Go to Right Window" }) -map("t", k.terminal.hide_terminal, "close", { desc = "Hide Terminal" }) -map("t", k.terminal.hide_terminal_alt, "close", { desc = "which_key_ignore" }) +map("t", k.terminal_enter_normal_mode, "", { desc = "Enter Normal Mode" }) +map("t", k.window_left, "wincmd h", { desc = "Go to Left Window" }) +map("t", k.window_lower, "wincmd j", { desc = "Go to Lower Window" }) +map("t", k.window_upper, "wincmd k", { desc = "Go to Upper Window" }) +map("t", k.window_right, "wincmd l", { desc = "Go to Right Window" }) +map("t", k.terminal_hide_terminal, "close", { desc = "Hide Terminal" }) +map("t", k.terminal_hide_terminal_alt, "close", { desc = "which_key_ignore" }) -- windows -map("n", k.windows.windows, "", { desc = "Windows", remap = true }) -map("n", k.windows.split_window_below, "s", { desc = "Split Window Below", remap = true }) -map("n", k.windows.split_window_right, "v", { desc = "Split Window Right", remap = true }) -map("n", k.windows.delete_window, "c", { desc = "Delete Window", remap = true }) -LazyVim.toggle.map(k.windows.toggle_maximize_window, LazyVim.toggle.maximize) +map("n", k.window_prefix, "", { desc = "Windows", remap = true }) +map("n", k.window_split_window_below, "s", { desc = "Split Window Below", remap = true }) +map("n", k.window_split_window_right, "v", { desc = "Split Window Right", remap = true }) +map("n", k.window_delete_window, "c", { desc = "Delete Window", remap = true }) +LazyVim.toggle.map(k.window_toggle_maximize_window, LazyVim.toggle.maximize) -- tabs -map("n", k.tabs.last_tab, "tablast", { desc = "Last Tab" }) -map("n", k.tabs.close_other_tabs, "tabonly", { desc = "Close Other Tabs" }) -map("n", k.tabs.first_tab, "tabfirst", { desc = "First Tab" }) -map("n", k.tabs.new_tab, "tabnew", { desc = "New Tab" }) -map("n", k.tabs.new_tab, "tabnext", { desc = "Next Tab" }) -map("n", k.tabs.close_other_tabs, "tabclose", { desc = "Close Tab" }) -map("n", k.tabs.previous_tab, "tabprevious", { desc = "Previous Tab" }) +map("n", k.tab_last_tab, "tablast", { desc = "Last Tab" }) +map("n", k.tab_close_other_tabs, "tabonly", { desc = "Close Other Tabs" }) +map("n", k.tab_first_tab, "tabfirst", { desc = "First Tab" }) +map("n", k.tab_new_tab, "tabnew", { desc = "New Tab" }) +map("n", k.tab_new_tab, "tabnext", { desc = "Next Tab" }) +map("n", k.tab_close_other_tabs, "tabclose", { desc = "Close Tab" }) +map("n", k.tab_previous_tab, "tabprevious", { desc = "Previous Tab" }) diff --git a/lua/lazyvim/keymaps.lua b/lua/lazyvim/keymaps.lua index 0e8e76cc..163af0a4 100644 --- a/lua/lazyvim/keymaps.lua +++ b/lua/lazyvim/keymaps.lua @@ -3,669 +3,676 @@ local M = {} ---@class LazyVimKeymaps local keymaps = nil +-- Comments are intentionally left in for keymap context acknowledgment +-- and easier navigation with '%' (matching parenthesis jump) + ---@class LazyVimKeymaps M.default_keymaps = { - keymaps = { - window = { - left = "", - lower = "", - upper = "", - right = "", - }, - resize_window = { - increase_height = "", - decrease_height = "", - decrease_width = "", - increase_width = "", - }, - move_lines = { - down = "", - up = "", - }, - buffers = { - prev = "", - next = "", - prev_alt = "[b", - next_alt = "]b", - switch_to_other = "bb", - switch_to_other_alt = "`", - delete = "bd", - delete_and_close = "bD", - }, - clear_search_diff_update_and_redraw = "ur", - save_file = "", - keywordprg = "K", - commenting = { - add_comment_below = "gco", - add_comment_above = "gcO", - }, - lazy = "l", - new_file = "fn", - location_list = "xl", - quickfix_list = "xq", - previous_quickfix = "[q", - next_quickfix = "]q", - format = "cf", - diagnostics = { - line_diagnostics = "cd", - next_diagnostic = "]d", - prev_diagnostic = "[d", - next_error = "]e", - prev_error = "[e", - next_warning = "]w", - prev_warning = "[w", - }, - toggle_options = { - auto_format_buffer = "uf", - auto_format_global = "uF", - spelling = "us", - wrap = "uw", - relativenumber = "uL", - diagnostics = "ud", - number = "ul", - conceallevel = "uc", - treesitter = "uT", - background = "ub", - inlay_hints = "uh", - }, - lazygit = { - toggle_root = "gg", - toggle_cwd = "gG", - blame_line = "gb", - browse = "gB", - current_file_history = "gf", - git_log_root = "gl", - git_log_cwd = "gL", - }, - quit_all = "qq", - inspect_pos = "ui", - inspect_tree = "uI", - lazyvim_changelog = "L", - terminal = { - floating_terminal = { - toggle_root = "ft", - toggle_cwd = "fT", - toggle_root_alt_1 = "", - toggle_root_alt_2 = "", - }, - enter_normal_mode = "", - hide_terminal = "", - hide_terminal_alt = "", - }, - windows = { - windows = "w", - split_window_below = "-", - split_window_right = "|", - delete_window = "wd", - toggle_maximize_window = "wm", - }, - tabs = { - last_tab = "l", - close_other_tabs = "o", - first_tab = "f", - new_tab = "", - next_tab = "]", - close_tab = "d", - previous_tab = "[", - }, - }, + -- keymaps = { + -- window = { + window_left = "", + window_lower = "", + window_upper = "", + window_right = "", + -- }, + -- resize_window = { + size_increase_height = "", + size_decrease_height = "", + size_decrease_width = "", + size_increase_width = "", + -- }, + -- move_lines = { + move_down = "", + move_up = "", + -- }, + -- buffers = { + buf_prev = "", + buf_next = "", + buf_prev_alt = "[b", + buf_next_alt = "]b", + buf_switch_to_other = "bb", + buf_switch_to_other_alt = "`", + buf_delete = "bd", + buf_delete_and_close = "bD", + -- }, + clear_search_diff_update_and_redraw = "ur", + save_file = "", + keywordprg = "K", + -- commenting = { + comment_add_below = "gco", + comment_add_above = "gcO", + -- }, + lazy = "l", + new_file = "fn", + location_list = "xl", + quickfix_list = "xq", + previous_quickfix = "[q", + next_quickfix = "]q", + format = "cf", + -- diagnostics = { + diagnostic_line_diagnostics = "cd", + diagnostic_next_diagnostic = "]d", + diagnostic_prev_diagnostic = "[d", + diagnostic_next_error = "]e", + diagnostic_prev_error = "[e", + diagnostic_next_warning = "]w", + diagnostic_prev_warning = "[w", + -- }, + -- toggle_options = { + toggle_auto_format_buffer = "uf", + toggle_auto_format_global = "uF", + toggle_spelling = "us", + toggle_wrap = "uw", + toggle_relativenumber = "uL", + toggle_diagnostics = "ud", + toggle_number = "ul", + toggle_conceallevel = "uc", + toggle_treesitter = "uT", + toggle_background = "ub", + toggle_inlay_hints = "uh", + -- }, + -- lazygit = { + lazygit_toggle_root = "gg", + lazygit_toggle_cwd = "gG", + lazygit_blame_line = "gb", + lazygit_browse = "gB", + lazygit_current_file_history = "gf", + lazygit_git_log_root = "gl", + lazygit_git_log_cwd = "gL", + -- }, + quit_all = "qq", + inspect_pos = "ui", + inspect_tree = "uI", + lazyvim_changelog = "L", + -- terminal = { + -- floating_terminal = { + terminal_toggle_root = "ft", + terminal_toggle_cwd = "fT", + terminal_toggle_root_alt_1 = "", + terminal_toggle_root_alt_2 = "", + -- }, + terminal_enter_normal_mode = "", + terminal_hide_terminal = "", + terminal_hide_terminal_alt = "", + -- }, + -- windows = { + window_prefix = "w", + window_split_window_below = "-", + window_split_window_right = "|", + window_delete_window = "wd", + window_toggle_maximize_window = "wm", + -- }, + -- tabs = { + tab_last_tab = "l", + tab_close_other_tabs = "o", + tab_first_tab = "f", + tab_new_tab = "", + tab_next_tab = "]", + tab_close_tab = "d", + tab_previous_tab = "[", + -- }, + -- }, quit_buffer = "q", - coding = { - cmp = { - scroll_docs_backward = "", - scroll_docs_forward = "", - select_next_item = "", - select_prev_item = "", - complete = "", - confirm_auto_select = "", - confirm_select = "", - confirm_replace = "", - abort = "", - snippet = { - jump_prev = "", - jump_next = "", - }, - }, - }, - editor = { - neo_tree = { - toggle_root = "fe", - toggle_cwd = "fE", - toggle_root_alt = "e", - toggle_cwd_alt = "E", - toggle_git_status = "ge", - toggle_buffers = "be", - window = { - open = "l", - close_node = "h", - copy_path_to_clipboard = "Y", - open_with_system_application = "O", - toggle_preview = "P", - }, - }, - grug_far = { - open = "sr", - }, - flash = { - jump = "s", - treesitter = "S", - remote = "r", - treesitter_search = "R", - toggle = "", - }, - which_key = { - group = { - tabs = "", - code = "c", - file_find = "f", - git = "g", - hunks = "gh", - quit_session = "q", - search = "s", - ui = "u", - diagnostics_quickfix = "x", - buffer = "b", - windows = "w", - }, - buffer_keymaps = "?", - window_hydra_mode = "", - }, - gitsigns = { - next_hunk = "]h", - prev_hunk = "[h", - last_hunk = "]H", - first_hunk = "[H", - stage_hunk = "ghs", - reset_hunk = "ghr", - stage_buffer = "ghS", - undo_stage_hunk = "ghu", - reset_buffer = "ghR", - preview_hunk_inline = "ghp", - blame_line = "ghb", - blame_buffer = "ghB", - diff_index = "ghd", - diff_commit = "ghD", - select_hunk = "ih", - }, - trouble = { - diagnostics_toggle = "xx", - diagnostics_buffer_toggle = "xX", - symbols_toggle = "cs", - lsp_toggle = "cS", - loclist_toggle = "xL", - qflist_toggle = "xQ", - previous_trouble = "[q", - next_trouble = "]q", - }, - todo_comments = { - next_todo = "]t", - prev_todo = "[t", - todo_trouble = "xt", - todo_fix_fixme_trouble = "xT", - todo_telescope = "st", - todo_fix_fixme_telescope = "sT", - }, - }, - formatting = { - conform = { - format = "cF", - }, - }, - treesitter = { - increment_selection = "", - decrement_selection = "", - textobjects = { - goto_next_start = { - function_outer = "]f", - class_outer = "]c", - parameter_inner = "]a", - }, - goto_next_end = { - function_outer = "]F", - class_outer = "]C", - parameter_inner = "]A", - }, - goto_previous_start = { - function_outer = "[f", - class_outer = "[c", - parameter_inner = "[a", - }, - goto_previous_end = { - function_outer = "[F", - class_outer = "[C", - parameter_inner = "[A", - }, - }, - }, - ui = { - nvim_notify = { - dismiss_all_notifications = "un", - }, - bufferline = { - toggle_pin = "bp", - delete_non_pinned_buffers = "bP", - delete_other_buffers = "bo", - delete_buffers_to_the_right = "br", - delete_buffers_to_the_left = "bl", - prev_buffer = "", - next_buffer = "", - prev_buffer_alt = "[b", - next_buffer_alt = "]b", - move_buffer_prev = "[B", - move_buffer_next = "]B", - }, - indent_blankline = { - toggle = "ug", - }, - noice = { - prefix = "sn", - redirect_cmdline = "", - last_message = "snl", - history = "snh", - all = "sna", - dismiss = "snd", - pick = "snt", - scroll_forward = "", - scroll_backward = "", - }, - dashboard = { - find_file = "f", - new_file = "n", - recent_files = "r", - find_text = "g", - config = "c", - restore_session = "s", - lazy_extras = "x", - lazy = "l", - quit = "q", - projects = "p", - }, - }, - util = { - persistence = { - restore_session = "qs", - select_session = "qS", - restore_last_session = "ql", - skip_current_session = "qd", - }, - mini_pairs = { - toggle = "up", - }, - }, - extras = { - coding = { - copilot_chat = { - submit_prompt = "", - prefix = "a", - toggle = "aa", - clear = "ax", - quick_chat = "aq", - diagnostic_help = "ad", - prompt_actions = "ap", - }, - luasnip = { - jump_next = "", - jump_prev = "", - }, - mini_surround = { - prefix = "gs", - add = "gsa", - delete = "gsd", - find = "gsf", - find_left = "gsF", - highlight = "gsh", - replace = "gsr", - update_n_lines = "gsn", - alt = { - prefix = "gz", - add = "gza", - delete = "gzd", - find = "gzf", - find_left = "gzF", - highlight = "gzh", - replace = "gzr", - update_n_lines = "gzn", - }, - }, - yanky = { - yank_history = "p", - yank = "y", - put_text_after_cursor = "p", - put_text_before_cursor = "P", - put_text_after_selection = "gp", - put_text_before_selection = "gP", - cycle_forward_yank_history = "[y", - cycle_backward_yank_history = "]y", - put_indent_after_cursor_linewise = "]p", - put_indent_before_cursor_linewise = "[p", - put_indent_after_cursor_linewise_alt = "]P", - put_indent_before_cursor_linewise_alt = "[P", - put_and_indent_right = ">p", - put_and_indent_left = " 0 do + local currentTable = table.remove(stack) + for key, value in pairs(currentTable) do + if type(value) == "table" then + table.insert(stack, value) + else + outputTable[key] = value + end + end + end + + return outputTable +end + ---@return LazyVimKeymaps M.get_keymaps = function() if keymaps == nil then - keymaps = vim.tbl_deep_extend("force", {}, M.default_keymaps, vim.g.lazyvim_keymaps or {}) - vim.g.lazyvim_keymaps = keymaps -- update global for retrieval + keymaps = + vim.tbl_deep_extend("force", {}, flattenTable(M.default_keymaps), flattenTable(vim.g.lazyvim_keymaps or {})) + vim.g.lazyvim_keymaps = keymaps -- update global for later retrieval end return keymaps end diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 47d7b606..a58c9353 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().coding +local k = require("lazyvim.keymaps").get_keymaps() return { @@ -28,16 +28,16 @@ return { local auto_select = true local mappings = {} local actions = { - { k.cmp.scroll_docs_backward, cmp.mapping.scroll_docs(-4) }, - { k.cmp.complete, cmp.mapping.complete() }, - { k.cmp.confirm_auto_select, LazyVim.cmp.confirm({ select = auto_select }) }, - { k.cmp.confirm_select, LazyVim.cmp.confirm({ select = true }) }, - { k.cmp.select_prev_item, cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) }, - { k.cmp.scroll_docs_forward, cmp.mapping.scroll_docs(4) }, - { k.cmp.select_next_item, cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) }, - { k.cmp.confirm_replace, LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }) }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + { k.cmp_scroll_docs_backward, cmp.mapping.scroll_docs(-4) }, + { k.cmp_complete, cmp.mapping.complete() }, + { k.cmp_confirm_auto_select, LazyVim.cmp.confirm({ select = auto_select }) }, + { k.cmp_confirm_select, LazyVim.cmp.confirm({ select = true }) }, + { k.cmp_select_prev_item, cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) }, + { k.cmp_scroll_docs_forward, cmp.mapping.scroll_docs(4) }, + { k.cmp_select_next_item, cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) }, + { k.cmp_confirm_replace, LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }) }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. { - k.cmp.abort, + k.cmp_abort, function(fallback) cmp.abort() fallback() @@ -56,7 +56,7 @@ return { completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), }, preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, - mapping = cmp.mapping.preset.insert({ mappings }), + mapping = cmp.mapping.preset.insert(mappings), sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "path" }, @@ -120,7 +120,7 @@ return { end, keys = { { - k.cmp.snippet.jump_prev, + k.snippet_jump_prev, function() return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" end, @@ -129,7 +129,7 @@ return { mode = { "i", "s" }, }, { - k.cmp.snippet.jump_next, + k.snippet_jump_next, function() return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" end, @@ -178,8 +178,8 @@ return { n_lines = 500, custom_textobjects = { o = ai.gen_spec.treesitter({ -- code block - a = { "@block.outer", "@conditional.outer", "@loop.outer" }, - i = { "@block.inner", "@conditional.inner", "@loop.inner" }, + a = { "@block", "@conditional.outer", "@loop.outer" }, + i = { "@block", "@conditional.inner", "@loop.inner" }, }), f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }), -- function c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }), -- class diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index b96da960..49d7e21c 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -1,5 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().editor -local s = require("lazyvim.keymaps").get_keymaps().extras.coding.mini_surround +local k = require("lazyvim.keymaps").get_keymaps() return { @@ -10,40 +9,40 @@ return { keys = function() return { { - k.neo_tree.toggle_root, + k.neotree_toggle_root, function() require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() }) end, desc = "Explorer NeoTree (Root Dir)", }, { - k.neo_tree.toggle_cwd, + k.neotree_toggle_cwd, function() require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) end, desc = "Explorer NeoTree (cwd)", }, { - k.neo_tree.toggle_root_alt, - k.neo_tree.toggle_root, + k.neotree_toggle_root_alt, + k.neotree_toggle_root, desc = "Explorer NeoTree (Root Dir)", remap = true, }, { - k.neo_tree.toggle_cwd_alt, - k.neo_tree.toggle_cwd, + k.neotree_toggle_cwd_alt, + k.neotree_toggle_cwd, desc = "Explorer NeoTree (cwd)", remap = true, }, { - k.neo_tree.toggle_git_status, + k.neotree_toggle_git_status, function() require("neo-tree.command").execute({ source = "git_status", toggle = true }) end, desc = "Git Explorer", }, { - k.neo_tree.toggle_buffers, + k.neotree_toggle_buffers, function() require("neo-tree.command").execute({ source = "buffers", toggle = true }) end, @@ -76,10 +75,10 @@ return { opts = function() local neo_tree_mappings = {} local neo_tree_actions = { - [k.neo_tree.window.open] = "open", - [k.neo_tree.window.close_node] = "close_node", + [k.neotree_win_open] = "open", + [k.neotree_win_close_node] = "close_node", [""] = "none", - [k.neo_tree.window.copy_path_to_clipboard] = { + [k.neotree_win_copy_path_to_clipboard] = { function(state) local node = state.tree:get_node() local path = node:get_id() @@ -87,13 +86,13 @@ return { end, desc = "Copy Path to Clipboard", }, - [k.neo_tree.window.open_with_system_application] = { + [k.neotree_win_open_with_system_application] = { function(state) require("lazy.util").open(state.tree:get_node().path, { system = true }) end, desc = "Open with System Application", }, - [k.neo_tree.window.toggle_preview] = { "toggle_preview", config = { use_float = false } }, + [k.neotree_win_toggle_preview] = { "toggle_preview", config = { use_float = false } }, } for key, value in pairs(neo_tree_actions) do if key and key ~= "" then @@ -158,7 +157,7 @@ return { cmd = "GrugFar", keys = { { - k.grug_far.open, + k.grugfar_open, function() local grug = require("grug-far") local ext = vim.bo.buftype == "" and vim.fn.expand("%:e") @@ -186,11 +185,11 @@ return { opts = {}, -- stylua: ignore keys = { - {k.flash.jump, mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, - {k.flash.treesitter, mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, - {k.flash.remote, mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, - {k.flash.treesitter_search, mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, - {k.flash.toggle, mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + {k.flash_jump, mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + {k.flash_treesitter, mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + {k.flash_remote, mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + {k.flash_treesitter_search, mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + {k.flash_toggle, mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, }, }, @@ -205,33 +204,33 @@ return { spec = { { mode = { "n", "v" }, - { k.which_key.group.tabs, group = "tabs" }, - { k.which_key.group.code, group = "code" }, - { k.which_key.group.file_find, group = "file/find" }, - { k.which_key.group.git, group = "git" }, - { k.which_key.group.hunks, group = "hunks" }, - { k.which_key.group.quit_session, group = "quit/session" }, - { k.which_key.group.search, group = "search" }, - { k.which_key.group.ui, group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, + { k.tabs_prefix, group = "tabs" }, + { k.code_prefix, group = "code" }, + { k.file_find_prefix, group = "file/find" }, + { k.git_prefix, group = "git" }, + { k.hunks_prefix, group = "hunks" }, + { k.quit_session_prefix, group = "quit/session" }, + { k.search_prefix, group = "search" }, + { k.ui_prefix, group = "ui", icon = { icon = "󰙵 ", color = "cyan" } }, { - k.which_key.group.diagnostics_quickfix, + k.diagnostics_quickfix_prefix, group = "diagnostics/quickfix", icon = { icon = "󱖫 ", color = "green" }, }, { "[", group = "prev" }, { "]", group = "next" }, { "g", group = "goto" }, - { s.prefix, group = "surround" }, + { k.minisurround_prefix, group = "surround" }, { "z", group = "fold" }, - k.which_key.group.buffer == "" and {} or { - k.which_key.group.buffer, + k.buffer_prefix == "" and {} or { + k.buffer_prefix, group = "buffer", expand = function() return require("which-key.extras").expand.buf() end, }, - k.which_key.group.windows == "" and {} or { - k.which_key.group.windows, + k.windows_prefix == "" and {} or { + k.windows_prefix, group = "windows", proxy = "", expand = function() @@ -245,14 +244,14 @@ return { }, keys = { { - k.which_key.buffer_keymaps, + k.buffer_keymaps, function() require("which-key").show({ global = false }) end, desc = "Buffer Keymaps (which-key)", }, { - k.which_key.window_hydra_mode, + k.window_hydra_mode, function() require("which-key").show({ keys = "", loop = true }) end, @@ -299,33 +298,33 @@ return { end -- stylua: ignore start - map("n", k.gitsigns.next_hunk, function() + map("n", k.gitsigns_next_hunk, function() if vim.wo.diff then vim.cmd.normal({ "]c", bang = true }) else gs.nav_hunk("next") end end, "Next Hunk") - map("n", k.gitsigns.prev_hunk, function() + map("n", k.gitsigns_prev_hunk, function() if vim.wo.diff then vim.cmd.normal({ "[c", bang = true }) else gs.nav_hunk("prev") end end, "Prev Hunk") - map("n", k.gitsigns.last_hunk, function() gs.nav_hunk("last") end, "Last Hunk") - map("n", k.gitsigns.first_hunk, function() gs.nav_hunk("first") end, "First Hunk") - map({ "n", "v" }, k.gitsigns.stage_hunk, ":Gitsigns stage_hunk", "Stage Hunk") - map({ "n", "v" }, k.gitsigns.reset_hunk, ":Gitsigns reset_hunk", "Reset Hunk") - map("n", k.gitsigns.stage_buffer, gs.stage_buffer, "Stage Buffer") - map("n", k.gitsigns.undo_stage_hunk, gs.undo_stage_hunk, "Undo Stage Hunk") - map("n", k.gitsigns.reset_buffer, gs.reset_buffer, "Reset Buffer") - map("n", k.gitsigns.preview_hunk_inline, gs.preview_hunk_inline, "Preview Hunk Inline") - map("n", k.gitsigns.blame_line, function() gs.blame_line({ full = true }) end, "Blame Line") - map("n", k.gitsigns.blame_buffer, function() gs.blame() end, "Blame Buffer") - map("n", k.gitsigns.diff_index, gs.diffthis, "Diff This") - map("n", k.gitsigns.diff_commit, function() gs.diffthis("~") end, "Diff This ~") - map({ "o", "x" }, k.gitsigns.select_hunk, ":Gitsigns select_hunk", "GitSigns Select Hunk") + map("n", k.gitsigns_last_hunk, function() gs.nav_hunk("last") end, "Last Hunk") + map("n", k.gitsigns_first_hunk, function() gs.nav_hunk("first") end, "First Hunk") + map({ "n", "v" }, k.gitsigns_stage_hunk, ":Gitsigns stage_hunk", "Stage Hunk") + map({ "n", "v" }, k.gitsigns_reset_hunk, ":Gitsigns reset_hunk", "Reset Hunk") + map("n", k.gitsigns_stage_buffer, gs.stage_buffer, "Stage Buffer") + map("n", k.gitsigns_undo_stage_hunk, gs.undo_stage_hunk, "Undo Stage Hunk") + map("n", k.gitsigns_reset_buffer, gs.reset_buffer, "Reset Buffer") + map("n", k.gitsigns_preview_hunk_inline, gs.preview_hunk_inline, "Preview Hunk Inline") + map("n", k.gitsigns_blame_line, function() gs.blame_line({ full = true }) end, "Blame Line") + map("n", k.gitsigns_blame_buffer, function() gs.blame() end, "Blame Buffer") + map("n", k.gitsigns_diff_index, gs.diffthis, "Diff This") + map("n", k.gitsigns_diff_commit, function() gs.diffthis("~") end, "Diff This ~") + map({ "o", "x" }, k.gitsigns_select_hunk, ":Gitsigns select_hunk", "GitSigns Select Hunk") end, }, }, @@ -342,18 +341,22 @@ return { }, }, keys = { - { k.trouble.diagnostics_toggle, "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)" }, + { k.trouble_diagnostics_toggle, "Trouble diagnostics toggle", desc = "Diagnostics (Trouble)" }, { - k.trouble.diagnostics_buffer_toggle, + k.trouble_diagnostics_buffer_toggle, "Trouble diagnostics toggle filter.buf=0", desc = "Buffer Diagnostics (Trouble)", }, - { k.trouble.symbols_toggle, "Trouble symbols toggle", desc = "Symbols (Trouble)" }, - { k.trouble.lsp_toggle, "Trouble lsp toggle", desc = "LSP references/definitions/... (Trouble)" }, - { k.trouble.loclist_toggle, "Trouble loclist toggle", desc = "Location List (Trouble)" }, - { k.trouble.qflist_toggle, "Trouble qflist toggle", desc = "Quickfix List (Trouble)" }, + { k.trouble_symbols_toggle, "Trouble symbols toggle", desc = "Symbols (Trouble)" }, { - k.trouble.previous_trouble, + k.trouble_lsp_toggle, + "Trouble lsp toggle", + desc = "LSP references/definitions/... (Trouble)", + }, + { k.trouble_loclist_toggle, "Trouble loclist toggle", desc = "Location List (Trouble)" }, + { k.trouble_qflist_toggle, "Trouble qflist toggle", desc = "Quickfix List (Trouble)" }, + { + k.trouble_previous_trouble, function() if require("trouble").is_open() then require("trouble").prev({ skip_groups = true, jump = true }) @@ -367,7 +370,7 @@ return { desc = "Previous Trouble/Quickfix Item", }, { - k.trouble.next_trouble, + k.trouble_next_trouble, function() if require("trouble").is_open() then require("trouble").next({ skip_groups = true, jump = true }) @@ -392,25 +395,25 @@ return { opts = {}, -- stylua: ignore keys = { - { k.todo_comments.next_todo, function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" }, - { k.todo_comments.prev_todo, function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" }, - { k.todo_comments.todo_trouble, "Trouble todo toggle", desc = "Todo (Trouble)" }, - { k.todo_comments.todo_fix_fixme_trouble, "Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}", desc = "Todo/Fix/Fixme (Trouble)" }, - { k.todo_comments.todo_telescope, "TodoTelescope", desc = "Todo" }, - { k.todo_comments.todo_fix_fixme_telescope, "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, + { k.todo_next_todo, function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" }, + { k.todo_prev_todo, function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" }, + { k.todo_trouble, "Trouble todo toggle", desc = "Todo (Trouble)" }, + { k.todo_fix_fixme_trouble, "Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}", desc = "Todo/Fix/Fixme (Trouble)" }, + { k.todo_telescope, "TodoTelescope", desc = "Todo" }, + { k.todo_fix_fixme_telescope, "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, }, }, { import = "lazyvim.plugins.extras.editor.fzf", enabled = function() - return LazyVim.pick.want() == "fzf" + return LazyVim.pick() == "fzf" end, }, { import = "lazyvim.plugins.extras.editor.telescope", enabled = function() - return LazyVim.pick.want() == "telescope" + return LazyVim.pick() == "telescope" end, }, } diff --git a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua index 341461f2..77cc99d9 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua @@ -1,5 +1,5 @@ local M = {} -local k = require("lazyvim.keymaps").get_keymaps().extras.coding.copilot_chat +local k = require("lazyvim.keymaps").get_keymaps() ---@param kind string function M.pick(kind) @@ -38,10 +38,10 @@ return { } end, keys = { - { k.submit_prompt, "", ft = "copilot-chat", desc = "Submit Prompt", remap = true }, - { k.prefix, "", desc = "+ai", mode = { "n", "v" } }, + { k.copilotchat_submit_prompt, "", ft = "copilot-chat", desc = "Submit Prompt", remap = true }, + { k.copilotchat_prefix, "", desc = "+ai", mode = { "n", "v" } }, { - k.toggle, + k.copilotchat_toggle, function() return require("CopilotChat").toggle() end, @@ -49,7 +49,7 @@ return { mode = { "n", "v" }, }, { - k.clear, + k.copilotchat_clear, function() return require("CopilotChat").reset() end, @@ -57,7 +57,7 @@ return { mode = { "n", "v" }, }, { - k.quick_chat, + k.copilotchat_quick_chat, function() local input = vim.fn.input("Quick Chat: ") if input ~= "" then @@ -68,9 +68,9 @@ return { mode = { "n", "v" }, }, -- Show help actions with telescope - { k.diagnostic_help, M.pick("help"), desc = "Diagnostic Help (CopilotChat)", mode = { "n", "v" } }, + { k.copilotchat_diagnostic_help, M.pick("help"), desc = "Diagnostic Help (CopilotChat)", mode = { "n", "v" } }, -- Show prompts actions with telescope - { k.prompt_actions, M.pick("prompt"), desc = "Prompt Actions (CopilotChat)", mode = { "n", "v" } }, + { k.copilotchat_prompt_actionsr, M.pick("prompt"), desc = "Prompt Actions (CopilotChat)", mode = { "n", "v" } }, }, config = function(_, opts) local chat = require("CopilotChat") diff --git a/lua/lazyvim/plugins/extras/coding/luasnip.lua b/lua/lazyvim/plugins/extras/coding/luasnip.lua index d2b484cc..664c403f 100644 --- a/lua/lazyvim/plugins/extras/coding/luasnip.lua +++ b/lua/lazyvim/plugins/extras/coding/luasnip.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.coding.luasnip +local k = require("lazyvim.keymaps").get_keymaps() return { { @@ -39,14 +39,14 @@ return { -- stylua: ignore keys = { { - k.jump_next, + k.snippet_jump_next, function() return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" end, expr = true, silent = true, mode = "i", }, - { k.jump_next, function() require("luasnip").jump(1) end, mode = "s" }, - { k.jump_prev, function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + { k.snippet_jump_next, function() require("luasnip").jump(1) end, mode = "s" }, + { k.snippet_jump_prev, function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, }, }, { diff --git a/lua/lazyvim/plugins/extras/coding/mini-surround.lua b/lua/lazyvim/plugins/extras/coding/mini-surround.lua index 7cfbfb62..575a59df 100644 --- a/lua/lazyvim/plugins/extras/coding/mini-surround.lua +++ b/lua/lazyvim/plugins/extras/coding/mini-surround.lua @@ -2,7 +2,7 @@ -- surrounding characters like brackets or quotes, this allows you -- to select the text inside, change or modify the surrounding characters, -- and more. -local k = require("lazyvim.keymaps").get_keymaps().extras.coding.mini_surround +local k = require("lazyvim.keymaps").get_keymaps() return { "echasnovski/mini.surround", @@ -26,13 +26,13 @@ return { end, opts = { mappings = { - add = k.add, -- Add surrounding in Normal and Visual modes - delete = k.delete, -- Delete surrounding - find = k.find, -- Find surrounding (to the right) - find_left = k.find_left, -- Find surrounding (to the left) - highlight = k.highlight, -- Highlight surrounding - replace = k.replace, -- Replace surrounding - update_n_lines = k.update_n_lines, -- Update `n_lines` + add = k.minisurround_add, -- Add surrounding in Normal and Visual modes + delete = k.minisurround_delete, -- Delete surrounding + find = k.minisurround_find, -- Find surrounding (to the right) + find_left = k.minisurround_find_left, -- Find surrounding (to the left) + highlight = k.minisurround_highlight, -- Highlight surrounding + replace = k.minisurround_replace, -- Replace surrounding + update_n_lines = k.minisurround_update_n_lines, -- Update `n_lines` }, }, } diff --git a/lua/lazyvim/plugins/extras/coding/yanky.lua b/lua/lazyvim/plugins/extras/coding/yanky.lua index 9f4c84e6..1173ab7a 100644 --- a/lua/lazyvim/plugins/extras/coding/yanky.lua +++ b/lua/lazyvim/plugins/extras/coding/yanky.lua @@ -1,5 +1,5 @@ -- better yank/paste -local k = require("lazyvim.keymaps").get_keymaps().extras.coding.yanky +local k = require("lazyvim.keymaps").get_keymaps() return { "gbprod/yanky.nvim", recommended = true, @@ -10,7 +10,7 @@ return { }, keys = { { - k.yank_history, + k.yanky_yank_history, function() if LazyVim.pick.picker.name == "telescope" then require("telescope").extensions.yank_history.yank_history({}) @@ -22,38 +22,48 @@ return { desc = "Open Yank History", }, -- stylua: ignore - { k.yank, "(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" }, - { k.put_text_after_cursor, "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Text After Cursor" }, - { k.put_text_before_cursor, "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Cursor" }, - { k.put_text_after_selection, "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put Text After Selection" }, - { k.put_text_before_selection, "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Selection" }, - { k.cycle_forward_yank_history, "(YankyCycleForward)", desc = "Cycle Forward Through Yank History" }, - { k.cycle_backward_yank_history, "(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" }, + { k.yanky_yank, "(YankyYank)", mode = { "n", "x" }, desc = "Yank Text" }, + { k.yanky_put_text_after_cursor, "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put Text After Cursor" }, + { k.yanky_put_text_before_cursor, "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put Text Before Cursor" }, { - k.put_indent_after_cursor_linewise, + k.yanky_put_text_after_selection, + "(YankyGPutAfter)", + mode = { "n", "x" }, + desc = "Put Text After Selection", + }, + { + k.yanky_put_text_before_selection, + "(YankyGPutBefore)", + mode = { "n", "x" }, + desc = "Put Text Before Selection", + }, + { k.yanky_cycle_forward_yank_history, "(YankyCycleForward)", desc = "Cycle Forward Through Yank History" }, + { k.yanky_cycle_backward_yank_history, "(YankyCycleBackward)", desc = "Cycle Backward Through Yank History" }, + { + k.yanky_put_indent_after_cursor_linewise, "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)", }, { - k.put_indent_before_cursor_linewise, + k.yanky_put_indent_before_cursor_linewise, "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)", }, { - k.put_indent_after_cursor_linewise_alt, + k.yanky_put_indent_after_cursor_linewise_alt, "(YankyPutIndentAfterLinewise)", desc = "Put Indented After Cursor (Linewise)", }, { - k.put_indent_before_cursor_linewise_alt, + k.yanky_put_indent_before_cursor_linewise_alt, "(YankyPutIndentBeforeLinewise)", desc = "Put Indented Before Cursor (Linewise)", }, - { k.put_and_indent_right, "(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" }, - { k.put_and_indent_left, "(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" }, - { k.put_before_indent_right, "(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" }, - { k.put_before_indent_left, "(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" }, - { k.put_after_filter, "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, - { k.put_before_filter, "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, + { k.yanky_put_and_indent_right, "(YankyPutIndentAfterShiftRight)", desc = "Put and Indent Right" }, + { k.yanky_put_and_indent_left, "(YankyPutIndentAfterShiftLeft)", desc = "Put and Indent Left" }, + { k.yanky_put_before_indent_right, "(YankyPutIndentBeforeShiftRight)", desc = "Put Before and Indent Right" }, + { k.yanky_put_before_indent_left, "(YankyPutIndentBeforeShiftLeft)", desc = "Put Before and Indent Left" }, + { k.yanky_put_after_filter, "(YankyPutAfterFilter)", desc = "Put After Applying a Filter" }, + { k.yanky_put_before_filter, "(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" }, }, } diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 64c0ee3f..d4b878ef 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.dap.core +local k = require("lazyvim.keymaps").get_keymaps() ---@param config {args?:string[]|fun():string[]?} local function get_args(config) @@ -29,24 +29,24 @@ return { -- stylua: ignore keys = { - { k.nvim_dap.prefix, "", desc = "+debug", mode = {"n", "v"} }, - { k.nvim_dap.breakpoint_condition, function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, - { k.nvim_dap.toggle_breakpoint, function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, - { k.nvim_dap.continue, function() require("dap").continue() end, desc = "Continue" }, - { k.nvim_dap.run_with_args, function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, - { k.nvim_dap.run_to_cursor, function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, - { k.nvim_dap.go_to_line_no_execute, function() require("dap").goto_() end, desc = "Go to Line (No Execute)" }, - { k.nvim_dap.step_into, function() require("dap").step_into() end, desc = "Step Into" }, - { k.nvim_dap.down, function() require("dap").down() end, desc = "Down" }, - { k.nvim_dap.up, function() require("dap").up() end, desc = "Up" }, - { k.nvim_dap.run_last, function() require("dap").run_last() end, desc = "Run Last" }, - { k.nvim_dap.step_out, function() require("dap").step_out() end, desc = "Step Out" }, - { k.nvim_dap.step_over, function() require("dap").step_over() end, desc = "Step Over" }, - { k.nvim_dap.pause, function() require("dap").pause() end, desc = "Pause" }, - { k.nvim_dap.toggle_repl, function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, - { k.nvim_dap.session, function() require("dap").session() end, desc = "Session" }, - { k.nvim_dap.terminate, function() require("dap").terminate() end, desc = "Terminate" }, - { k.nvim_dap.widgets, function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + { k.dap_prefix, "", desc = "+debug", mode = {"n", "v"} }, + { k.dap_breakpoint_condition, function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, + { k.dap_toggle_breakpoint, function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, + { k.dap_continue, function() require("dap").continue() end, desc = "Continue" }, + { k.dap_run_with_args, function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, + { k.dap_run_to_cursor, function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, + { k.dap_go_to_line_no_execute, function() require("dap").goto_() end, desc = "Go to Line (No Execute)" }, + { k.dap_step_into, function() require("dap").step_into() end, desc = "Step Into" }, + { k.dap_down, function() require("dap").down() end, desc = "Down" }, + { k.dap_up, function() require("dap").up() end, desc = "Up" }, + { k.dap_run_last, function() require("dap").run_last() end, desc = "Run Last" }, + { k.dap_step_out, function() require("dap").step_out() end, desc = "Step Out" }, + { k.dap_step_over, function() require("dap").step_over() end, desc = "Step Over" }, + { k.dap_pause, function() require("dap").pause() end, desc = "Pause" }, + { k.dap_toggle_repl, function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, + { k.dap_session, function() require("dap").session() end, desc = "Session" }, + { k.dap_terminate, function() require("dap").terminate() end, desc = "Terminate" }, + { k.dap_widgets, function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, }, config = function() @@ -80,8 +80,8 @@ return { dependencies = { "nvim-neotest/nvim-nio" }, -- stylua: ignore keys = { - { k.nvim_dap_ui.toggle_dap_ui, function() require("dapui").toggle({ }) end, desc = "Dap UI" }, - { k.nvim_dap_ui.eval_dap_ui, function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, + { k.toggle_dap_ui, function() require("dapui").toggle({ }) end, desc = "Dap UI" }, + { k.dap_eval_dap_ui, function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, }, opts = {}, config = function(_, opts) diff --git a/lua/lazyvim/plugins/extras/editor/aerial.lua b/lua/lazyvim/plugins/extras/editor/aerial.lua index b6763e6a..41f39869 100644 --- a/lua/lazyvim/plugins/extras/editor/aerial.lua +++ b/lua/lazyvim/plugins/extras/editor/aerial.lua @@ -1,6 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.aerial -local p = require("lazyvim.keymaps").get_keymaps().extras.editor.picker -local t = require("lazyvim.keymaps").get_keymaps().editor.trouble +local k = require("lazyvim.keymaps").get_keymaps() return { desc = "Aerial Symbol Browser", @@ -47,7 +45,7 @@ return { return opts end, keys = { - { k.toggle, "AerialToggle", desc = "Aerial (Symbols)" }, + { k.aerial_toggle, "AerialToggle", desc = "Aerial (Symbols)" }, }, }, @@ -55,7 +53,7 @@ return { "folke/trouble.nvim", optional = true, keys = { - { t.symbols_toggle, false }, + { k.trouble_symbols_toggle, false }, }, }, @@ -70,7 +68,7 @@ return { end, keys = { { - p.go_to_symbol, + k.picker_go_to_symbol, "Telescope aerial", desc = "Goto Symbol (Aerial)", }, diff --git a/lua/lazyvim/plugins/extras/editor/dial.lua b/lua/lazyvim/plugins/extras/editor/dial.lua index 4d4038ed..21db8f20 100644 --- a/lua/lazyvim/plugins/extras/editor/dial.lua +++ b/lua/lazyvim/plugins/extras/editor/dial.lua @@ -1,5 +1,5 @@ local M = {} -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.dial +local k = require("lazyvim.keymaps").get_keymaps() ---@param increment boolean ---@param g? boolean @@ -19,9 +19,9 @@ return { -- stylua: ignore keys = { { k.increase, function() return M.dial(true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, - { k.decrement, function() return M.dial(false) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, - { k.increment_g, function() return M.dial(true, true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, - { k.decrement_g, function() return M.dial(false, true) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, + { k.dial_decrement, function() return M.dial(false) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, + { k.dial_increment_g, function() return M.dial(true, true) end, expr = true, desc = "Increment", mode = {"n", "v"} }, + { k.dial_decrement_g, function() return M.dial(false, true) end, expr = true, desc = "Decrement", mode = {"n", "v"} }, }, opts = function() local augend = require("dial.augend") diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index d47b5b6a..ed656d9c 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -1,6 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.picker -local lang = require("lazyvim.keymaps").get_keymaps().extras.lang -local t = require("lazyvim.keymaps").get_keymaps().editor.todo_comments +local k = require("lazyvim.keymaps").get_keymaps() if lazyvim_docs then -- In case you don't want to use `:LazyExtras`, @@ -103,8 +101,8 @@ return { end local default_keymaps = { - [k.actions.find_files_no_ignore] = { actions.toggle_ignore }, - [k.actions.find_files_with_hidden] = { actions.toggle_hidden }, + [k.picker_find_files_no_ignore] = { actions.toggle_ignore }, + [k.picker_find_files_with_hidden] = { actions.toggle_hidden }, } local keymaps = {} @@ -215,50 +213,59 @@ return { { "", "", ft = "fzf", mode = "t", nowait = true }, { "", "", ft = "fzf", mode = "t", nowait = true }, { - k.switch_buffer, + k.picker_switch_buffer, "FzfLua buffers sort_mru=true sort_lastused=true", desc = "Switch Buffer", }, - { k.grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, - { k.command_history, "FzfLua command_history", desc = "Command History" }, - { k.find_files_root, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { k.picker_grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, + { k.picker_command_history, "FzfLua command_history", desc = "Command History" }, + { k.picker_find_files_root, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, -- find - { k.find_buffers, "FzfLua buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, - { k.find_config_file, LazyVim.pick.config_files(), desc = "Find Config File" }, - { k.find_files_root_alt, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, - { k.find_files_cwd, LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, - { k.find_git_files, "FzfLua git_files", desc = "Find Files (git-files)" }, - { k.find_recent_files, "FzfLua oldfiles", desc = "Recent" }, - { k.find_recent_files_cwd, LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" }, + { k.picker_find_buffers, "FzfLua buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, + { k.picker_find_config_file, LazyVim.pick.config_files(), desc = "Find Config File" }, + { k.picker_find_files_root_alt, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { k.picker_find_files_cwd, LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, + { k.picker_find_git_files, "FzfLua git_files", desc = "Find Files (git-files)" }, + { k.picker_find_recent_files, "FzfLua oldfiles", desc = "Recent" }, + { k.picker_find_recent_files_cwd, LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" }, -- git - { k.git_commits, "FzfLua git_commits", desc = "Commits" }, - { k.git_status, "FzfLua git_status", desc = "Status" }, + { k.picker_git_commits, "FzfLua git_commits", desc = "Commits" }, + { k.picker_git_status, "FzfLua git_status", desc = "Status" }, -- search - { k.search_registers, "FzfLua registers", desc = "Registers" }, - { k.search_autocommands, "FzfLua autocmds", desc = "Auto Commands" }, - { k.search_buffer, "FzfLua grep_curbuf", desc = "Buffer" }, - { k.search_command_history, "FzfLua command_history", desc = "Command History" }, - { k.search_commands, "FzfLua commands", desc = "Commands" }, - { k.search_document_diagnostics, "FzfLua diagnostics_document", desc = "Document Diagnostics" }, - { k.search_workspace_diagnostics, "FzfLua diagnostics_workspace", desc = "Workspace Diagnostics" }, - { k.search_grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, - { k.search_grep_cwd, LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, - { k.search_help_pages, "FzfLua help_tags", desc = "Help Pages" }, - { k.search_highlight_groups, "FzfLua highlights", desc = "Search Highlight Groups" }, - { k.search_jumplist, "FzfLua jumps", desc = "Jumplist" }, - { k.search_keymaps, "FzfLua keymaps", desc = "Key Maps" }, - { k.search_loclist, "FzfLua loclist", desc = "Location List" }, - { k.search_man_pages, "FzfLua man_pages", desc = "Man Pages" }, - { k.search_marks, "FzfLua marks", desc = "Jump to Mark" }, - { k.search_resume, "FzfLua resume", desc = "Resume" }, - { k.search_quickfix, "FzfLua quickfix", desc = "Quickfix List" }, - { k.search_word_root, LazyVim.pick("grep_cword"), desc = "Word (Root Dir)" }, - { k.search_word_cwd, LazyVim.pick("grep_cword", { root = false }), desc = "Word (cwd)" }, - { k.search_selection_root, LazyVim.pick("grep_visual"), mode = "v", desc = "Selection (Root Dir)" }, - { k.search_selection_cwd, LazyVim.pick("grep_visual", { root = false }), mode = "v", desc = "Selection (cwd)" }, - { k.colorscheme_preview, LazyVim.pick("colorschemes"), desc = "Colorscheme with Preview" }, + { k.picker_search_registers, "FzfLua registers", desc = "Registers" }, + { k.picker_search_autocommands, "FzfLua autocmds", desc = "Auto Commands" }, + { k.picker_search_buffer, "FzfLua grep_curbuf", desc = "Buffer" }, + { k.picker_search_command_history, "FzfLua command_history", desc = "Command History" }, + { k.picker_search_commands, "FzfLua commands", desc = "Commands" }, + { k.picker_search_document_diagnostics, "FzfLua diagnostics_document", desc = "Document Diagnostics" }, { - k.go_to_symbol, + k.picker_search_workspace_diagnostics, + "FzfLua diagnostics_workspace", + desc = "Workspace Diagnostics", + }, + { k.picker_search_grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, + { k.picker_search_grep_cwd, LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, + { k.picker_search_help_pages, "FzfLua help_tags", desc = "Help Pages" }, + { k.picker_search_highlight_groups, "FzfLua highlights", desc = "Search Highlight Groups" }, + { k.picker_search_jumplist, "FzfLua jumps", desc = "Jumplist" }, + { k.picker_search_keymaps, "FzfLua keymaps", desc = "Key Maps" }, + { k.picker_search_loclist, "FzfLua loclist", desc = "Location List" }, + { k.picker_search_man_pages, "FzfLua man_pages", desc = "Man Pages" }, + { k.picker_search_marks, "FzfLua marks", desc = "Jump to Mark" }, + { k.picker_search_resume, "FzfLua resume", desc = "Resume" }, + { k.picker_search_quickfix, "FzfLua quickfix", desc = "Quickfix List" }, + { k.picker_search_word_root, LazyVim.pick("grep_cword"), desc = "Word (Root Dir)" }, + { k.picker_search_word_cwd, LazyVim.pick("grep_cword", { root = false }), desc = "Word (cwd)" }, + { k.picker_search_selection_root, LazyVim.pick("grep_visual"), mode = "v", desc = "Selection (Root Dir)" }, + { + k.picker_search_selection_cwd, + LazyVim.pick("grep_visual", { root = false }), + mode = "v", + desc = "Selection (cwd)", + }, + { k.picker_colorscheme_preview, LazyVim.pick("colorschemes"), desc = "Colorscheme with Preview" }, + { + k.picker_go_to_symbol, function() require("fzf-lua").lsp_document_symbols({ regex_filter = symbols_filter, @@ -267,7 +274,7 @@ return { desc = "Goto Symbol", }, { - k.go_to_symbol_workspace, + k.picker_go_to_symbol_workspace, function() require("fzf-lua").lsp_live_workspace_symbols({ regex_filter = symbols_filter, @@ -283,8 +290,8 @@ return { optional = true, -- stylua: ignore keys = { - { t.todo_telescope, function() require("todo-comments.fzf").todo() end, desc = "Todo" }, - { t.todo_fix_fixme_telescope, function () require("todo-comments.fzf").todo({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" }, + { k.todo_telescope, function() require("todo-comments.fzf").todo() end, desc = "Todo" }, + { k.todo_fix_fixme_telescope, function () require("todo-comments.fzf").todo({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" }, }, }, @@ -294,10 +301,10 @@ return { local Keys = require("lazyvim.plugins.lsp.keymaps").get() -- stylua: ignore vim.list_extend(Keys, { - { lang.go_to_definition, "FzfLua lsp_definitions jump_to_single_result=true ignore_current_line=true", desc = "Goto Definition", has = "definition" }, - { lang.references, "FzfLua lsp_references jump_to_single_result=true ignore_current_line=true", desc = "References", nowait = true }, - { lang.go_to_implementation, "FzfLua lsp_implementations jump_to_single_result=true ignore_current_line=true", desc = "Goto Implementation" }, - { lang.go_to_type_definition, "FzfLua lsp_typedefs jump_to_single_result=true ignore_current_line=true", desc = "Goto T[y]pe Definition" }, + { k.lang_go_to_definition, "FzfLua lsp_definitions jump_to_single_result=true ignore_current_line=true", desc = "Goto Definition", has = "definition" }, + { k.lang_references, "FzfLua lsp_references jump_to_single_result=true ignore_current_line=true", desc = "References", nowait = true }, + { k.lang_go_to_implementation, "FzfLua lsp_implementations jump_to_single_result=true ignore_current_line=true", desc = "Goto Implementation" }, + { k.lang_go_to_type_definition, "FzfLua lsp_typedefs jump_to_single_result=true ignore_current_line=true", desc = "Goto T[y]pe Definition" }, }) end, }, diff --git a/lua/lazyvim/plugins/extras/editor/harpoon2.lua b/lua/lazyvim/plugins/extras/editor/harpoon2.lua index 19d2515e..69532498 100644 --- a/lua/lazyvim/plugins/extras/editor/harpoon2.lua +++ b/lua/lazyvim/plugins/extras/editor/harpoon2.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.harpoon2 +local k = require("lazyvim.keymaps").get_keymaps() return { "ThePrimeagen/harpoon", diff --git a/lua/lazyvim/plugins/extras/editor/illuminate.lua b/lua/lazyvim/plugins/extras/editor/illuminate.lua index 2bc7b785..53e037ba 100644 --- a/lua/lazyvim/plugins/extras/editor/illuminate.lua +++ b/lua/lazyvim/plugins/extras/editor/illuminate.lua @@ -1,7 +1,7 @@ -- Automatically highlights other instances of the word under your cursor. -- This works with LSP, Treesitter, and regexp matching to find the other -- instances. -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.vim_illuminate +local k = require("lazyvim.keymaps").get_keymaps() return { { @@ -23,21 +23,21 @@ return { end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer }) end - map(k.next, "next") - map(k.prev, "prev") + map(k.illuminate_next, "next") + map(k.illuminate_prev, "prev") -- also set it after loading ftplugins, since a lot overwrite [[ and ]] vim.api.nvim_create_autocmd("FileType", { callback = function() local buffer = vim.api.nvim_get_current_buf() - map(k.next, "next", buffer) - map(k.prev, "prev", buffer) + map(k.illuminate_next, "next", buffer) + map(k.illuminate_prev, "prev", buffer) end, }) end, keys = { - { k.next, desc = "Next Reference" }, - { k.prev, desc = "Prev Reference" }, + { k.illuminate_next, desc = "Next Reference" }, + { k.illuminate_prev, desc = "Prev Reference" }, }, }, { diff --git a/lua/lazyvim/plugins/extras/editor/inc-rename.lua b/lua/lazyvim/plugins/extras/editor/inc-rename.lua index 8421e536..17dea1aa 100644 --- a/lua/lazyvim/plugins/extras/editor/inc-rename.lua +++ b/lua/lazyvim/plugins/extras/editor/inc-rename.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.inc_rename +local k = require("lazyvim.keymaps").get_keymaps() return { @@ -17,7 +17,7 @@ return { opts = function() local keys = require("lazyvim.plugins.lsp.keymaps").get() keys[#keys + 1] = { - k.rename, + k.increname_rename, function() local inc_rename = require("inc_rename") return ":" .. inc_rename.config.cmd_name .. " " .. vim.fn.expand("") diff --git a/lua/lazyvim/plugins/extras/editor/leap.lua b/lua/lazyvim/plugins/extras/editor/leap.lua index 73167c71..aab6aea7 100644 --- a/lua/lazyvim/plugins/extras/editor/leap.lua +++ b/lua/lazyvim/plugins/extras/editor/leap.lua @@ -1,6 +1,5 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.leap -local m = require("lazyvim.keymaps").get_keymaps().extras.coding.mini_surround -local default = require("lazyvim.keymaps").default_keymaps.extras.coding.mini_surround +local k = require("lazyvim.keymaps").get_keymaps() +local default = require("lazyvim.keymaps").default_keymaps return { -- disable flash @@ -24,9 +23,9 @@ return { "ggandor/leap.nvim", enabled = true, keys = { - { k.next, mode = { "n", "x", "o" }, desc = "Leap Forward to" }, - { k.prev, mode = { "n", "x", "o" }, desc = "Leap Backward to" }, - { k.from_windows, mode = { "n", "x", "o" }, desc = "Leap from Windows" }, + { k.leap_next, mode = { "n", "x", "o" }, desc = "Leap Forward to" }, + { k.leap_prev, mode = { "n", "x", "o" }, desc = "Leap Backward to" }, + { k.leap_from_windows, mode = { "n", "x", "o" }, desc = "Leap from Windows" }, }, config = function(_, opts) local leap = require("leap") @@ -45,17 +44,22 @@ return { optional = true, opts = { mappings = { - add = m.add == default.add and "gza" or m.add, -- Add surrounding in Normal and Visual modes - delete = m.delete == default.delete and "gzd" or m.delete, -- Delete surrounding - find = m.find == default.find and "gzf" or m.find, -- Find surrounding (to the right) - find_left = m.find_left == default.find_left and "gzF" or m.find_left, -- Find surrounding (to the left) - highlight = m.highlight == default.highlight and "gzh" or m.highlight, -- Highlight surrounding - replace = m.replace == default.replace and "gzr" or m.replace, -- Replace surrounding - update_n_lines = m.update_n_lines == default.update_n_lines and "gzn" or m.update_n_lines, -- Update `n_lines` + add = k.minisurround_add == default.minisurround_add and "gza" or k.minisurround_add, -- Add surrounding in Normal and Visual modes + delete = k.minisurround_delete == default.minisurround_delete and "gzd" or k.minisurround_delete, -- Delete surrounding + find = k.minisurround_find == default.minisurround_find and "gzf" or k.minisurround_find, -- Find surrounding (to the right) + find_left = k.minisurround_find_left == default.minisurround_find_left and "gzF" or k.minisurround_find_left, -- Find surrounding (to the left) + highlight = k.minisurround_highlight == default.minisurround_highlight and "gzh" or k.minisurround_highlight, -- Highlight surrounding + replace = k.minisurround_replace == default.minisurround_replace and "gzr" or k.minisurround_replace, -- Replace surrounding + update_n_lines = k.minisurround_update_n_lines == default.minisurround_update_n_lines and "gzn" + or k.minisurround_update_n_lines, -- Update `n_lines` }, }, keys = { - { m.prefix == default.prefix and "gz" or m.prefix, "", desc = "+surround" }, + { + k.minisurround_prefix == default.minisurround_prefix and "gz" or k.minisurround_prefix, + "", + desc = "+surround", + }, }, }, diff --git a/lua/lazyvim/plugins/extras/editor/mini-diff.lua b/lua/lazyvim/plugins/extras/editor/mini-diff.lua index 0d5fb1b2..5ac007aa 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-diff.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-diff.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.mini_diff +local k = require("lazyvim.keymaps").get_keymaps() return { -- disable gitsigns.nvim @@ -13,7 +13,7 @@ return { event = "VeryLazy", keys = { { - k.toggle_overlay, + k.minidiff_toggle_overlay, function() require("mini.diff").toggle_overlay(0) end, diff --git a/lua/lazyvim/plugins/extras/editor/mini-files.lua b/lua/lazyvim/plugins/extras/editor/mini-files.lua index e9904745..1aee163a 100644 --- a/lua/lazyvim/plugins/extras/editor/mini-files.lua +++ b/lua/lazyvim/plugins/extras/editor/mini-files.lua @@ -1,5 +1,5 @@ local map = LazyVim.keymap_set -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.mini_files +local k = require("lazyvim.keymaps").get_keymaps() return { "echasnovski/mini.files", @@ -17,14 +17,14 @@ return { }, keys = { { - k.open_current_file_dir, + k.minifiles_open_current_file_dir, function() require("mini.files").open(vim.api.nvim_buf_get_name(0), true) end, desc = "Open mini.files (Directory of Current File)", }, { - k.open_cwd, + k.minifiles_open_cwd, function() require("mini.files").open(vim.uv.cwd(), true) end, diff --git a/lua/lazyvim/plugins/extras/editor/outline.lua b/lua/lazyvim/plugins/extras/editor/outline.lua index eeb95d86..e557660f 100644 --- a/lua/lazyvim/plugins/extras/editor/outline.lua +++ b/lua/lazyvim/plugins/extras/editor/outline.lua @@ -1,5 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().editor.trouble -local o = require("lazyvim.keymaps").get_keymaps().extras.editor.outline +local k = require("lazyvim.keymaps").get_keymaps() return { -- Disable `cs` keymap so it doesn't conflict with `outline.nvim` @@ -7,12 +6,12 @@ return { "folke/trouble.nvim", optional = true, keys = { - { k.symbols_toggle, false }, + { k.trouble_symbols_toggle, false }, }, }, { "hedyhli/outline.nvim", - keys = { { k.symbols_toggle, "Outline", desc = "Toggle Outline" } }, + keys = { { k.trouble_symbols_toggle, "Outline", desc = "Toggle Outline" } }, cmd = "Outline", opts = function() local defaults = require("outline.config").defaults @@ -25,8 +24,8 @@ return { } local keymaps = { - up_and_jump = o.up_and_jump, - down_and_jump = o.down_and_jump, + up_and_jump = k.outline_up_and_jump, + down_and_jump = k.outline_down_and_jump, } for key, value in pairs(keymaps) do if value and value ~= "" then diff --git a/lua/lazyvim/plugins/extras/editor/overseer.lua b/lua/lazyvim/plugins/extras/editor/overseer.lua index dbe16d02..b5e9cf47 100644 --- a/lua/lazyvim/plugins/extras/editor/overseer.lua +++ b/lua/lazyvim/plugins/extras/editor/overseer.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.overseer +local k = require("lazyvim.keymaps").get_keymaps() return { { @@ -53,13 +53,13 @@ return { }, -- stylua: ignore keys = { - { k.toggle, "OverseerToggle", desc = "Task list" }, - { k.run, "OverseerRun", desc = "Run task" }, - { k.quick_action, "OverseerQuickAction", desc = "Action recent task" }, - { k.info, "OverseerInfo", desc = "Overseer Info" }, - { k.build, "OverseerBuild", desc = "Task builder" }, - { k.task_action, "OverseerTaskAction", desc = "Task action" }, - { k.clear_cache, "OverseerClearCache", desc = "Clear cache" }, + { k.overseer_toggle, "OverseerToggle", desc = "Task list" }, + { k.overseer_run, "OverseerRun", desc = "Run task" }, + { k.overseer_quick_action, "OverseerQuickAction", desc = "Action recent task" }, + { k.overseer_info, "OverseerInfo", desc = "Overseer Info" }, + { k.overseer_build, "OverseerBuild", desc = "Task builder" }, + { k.overseer_task_action, "OverseerTaskAction", desc = "Task action" }, + { k.overseer_clear_cache, "OverseerClearCache", desc = "Clear cache" }, }, }, { @@ -67,7 +67,7 @@ return { optional = true, opts = { spec = { - k.prefix == "" and {} or { k.prefix, group = "overseer" }, + k.overseer_prefix == "" and {} or { k.overseer_prefix, group = "overseer" }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/editor/refactoring.lua b/lua/lazyvim/plugins/extras/editor/refactoring.lua index d7a009e8..49bd930c 100644 --- a/lua/lazyvim/plugins/extras/editor/refactoring.lua +++ b/lua/lazyvim/plugins/extras/editor/refactoring.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.refactoring +local k = require("lazyvim.keymaps").get_keymaps() local pick = function() if LazyVim.pick.picker.name == "telescope" then @@ -30,15 +30,15 @@ return { "nvim-treesitter/nvim-treesitter", }, keys = { - { k.prefix, "", desc = "+refactor", mode = { "n", "v" } }, + { k.refactoring_prefix, "", desc = "+refactor", mode = { "n", "v" } }, { - k.refactor, + k.refactoring_refactor, pick, mode = "v", desc = "Refactor", }, { - k.inline_variable, + k.refactoring_inline_variable, function() require("refactoring").refactor("Inline Variable") end, @@ -46,42 +46,42 @@ return { desc = "Inline Variable", }, { - k.extract_block, + k.refactoring_extract_block, function() require("refactoring").refactor("Extract Block") end, desc = "Extract Block", }, { - k.extract_block_to_file, + k.refactoring_extract_block_to_file, function() require("refactoring").refactor("Extract Block To File") end, desc = "Extract Block To File", }, { - k.debug_print, + k.refactoring_debug_print, function() require("refactoring").debug.printf({ below = false }) end, desc = "Debug Print", }, { - k.debug_print_variable, + k.refactoring_debug_print_variable, function() require("refactoring").debug.print_var({ normal = true }) end, desc = "Debug Print Variable", }, { - k.debug_cleanup, + k.refactoring_debug_cleanup, function() require("refactoring").debug.cleanup({}) end, desc = "Debug Cleanup", }, { - k.extract_function, + k.refactoring_extract_function, function() require("refactoring").refactor("Extract Function") end, @@ -89,7 +89,7 @@ return { desc = "Extract Function", }, { - k.extract_function_to_file, + k.refactoring_extract_function_to_file, function() require("refactoring").refactor("Extract Function To File") end, @@ -97,7 +97,7 @@ return { desc = "Extract Function To File", }, { - k.extract_variable, + k.refactoring_extract_variable, function() require("refactoring").refactor("Extract Variable") end, @@ -105,7 +105,7 @@ return { desc = "Extract Variable", }, { - k.debug_print_variable, + k.refactoring_debug_print_variable, function() require("refactoring").debug.print_var() end, diff --git a/lua/lazyvim/plugins/extras/editor/telescope.lua b/lua/lazyvim/plugins/extras/editor/telescope.lua index 87856b57..7d5925a4 100644 --- a/lua/lazyvim/plugins/extras/editor/telescope.lua +++ b/lua/lazyvim/plugins/extras/editor/telescope.lua @@ -1,6 +1,4 @@ -local extras = require("lazyvim.keymaps").get_keymaps().extras -local k = extras.editor.picker -local lang = extras.lang +local k = require("lazyvim.keymaps").get_keymaps() if lazyvim_docs then -- In case you don't want to use `:LazyExtras`, @@ -90,55 +88,64 @@ return { }, keys = { { - k.switch_buffer, + k.picker_switch_buffer, "Telescope buffers sort_mru=true sort_lastused=true", desc = "Switch Buffer", }, - { k.grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, - { k.command_history, "Telescope command_history", desc = "Command History" }, - { k.find_files_root, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { k.picker_grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, + { k.picker_command_history, "Telescope command_history", desc = "Command History" }, + { k.picker_find_files_root, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, -- find - { k.find_buffers, "Telescope buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, - { k.find_config_file, LazyVim.pick.config_files(), desc = "Find Config File" }, - { k.find_files_root_alt, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, - { k.find_files_cwd, LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, - { k.find_git_files, "Telescope git_files", desc = "Find Files (git-files)" }, - { k.find_recent_files, "Telescope oldfiles", desc = "Recent" }, - { k.find_files_cwd, LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" }, + { k.picker_find_buffers, "Telescope buffers sort_mru=true sort_lastused=true", desc = "Buffers" }, + { k.picker_find_config_file, LazyVim.pick.config_files(), desc = "Find Config File" }, + { k.picker_find_files_root_alt, LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, + { k.picker_find_files_cwd, LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, + { k.picker_find_git_files, "Telescope git_files", desc = "Find Files (git-files)" }, + { k.picker_find_recent_files, "Telescope oldfiles", desc = "Recent" }, + { k.picker_find_files_cwd, LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" }, -- git - { k.git_commits, "Telescope git_commits", desc = "Commits" }, - { k.git_status, "Telescope git_status", desc = "Status" }, + { k.picker_git_commits, "Telescope git_commits", desc = "Commits" }, + { k.picker_git_status, "Telescope git_status", desc = "Status" }, -- search - { k.search_registers, "Telescope registers", desc = "Registers" }, - { k.search_autocommands, "Telescope autocommands", desc = "Auto Commands" }, - { k.search_buffer, "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, - { k.search_command_history, "Telescope command_history", desc = "Command History" }, - { k.search_commands, "Telescope commands", desc = "Commands" }, - { k.search_document_diagnostics, "Telescope diagnostics bufnr=0", desc = "Document Diagnostics" }, - { k.search_workspace_diagnostics, "Telescope diagnostics", desc = "Workspace Diagnostics" }, - { k.search_grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, - { k.search_grep_cwd, LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, - { k.search_help_pages, "Telescope help_tags", desc = "Help Pages" }, - { k.search_highlight_groups, "Telescope highlights", desc = "Search Highlight Groups" }, - { k.search_jumplist, "Telescope jumplist", desc = "Jumplist" }, - { k.search_keymaps, "Telescope keymaps", desc = "Key Maps" }, - { k.search_loclist, "Telescope loclist", desc = "Location List" }, - { k.search_man_pages, "Telescope man_pages", desc = "Man Pages" }, - { k.search_marks, "Telescope marks", desc = "Jump to Mark" }, - { k.search_options, "Telescope vim_options", desc = "Options" }, - { k.search_resume, "Telescope resume", desc = "Resume" }, - { k.search_quickfix, "Telescope quickfix", desc = "Quickfix List" }, - { k.search_word_root, LazyVim.pick("grep_string", { word_match = "-w" }), desc = "Word (Root Dir)" }, - { k.search_word_cwd, LazyVim.pick("grep_string", { root = false, word_match = "-w" }), desc = "Word (cwd)" }, - { k.search_selection_root, LazyVim.pick("grep_string"), mode = "v", desc = "Selection (Root Dir)" }, - { k.search_selection_cwd, LazyVim.pick("grep_string", { root = false }), mode = "v", desc = "Selection (cwd)" }, + { k.picker_search_registers, "Telescope registers", desc = "Registers" }, + { k.picker_search_autocommands, "Telescope autocommands", desc = "Auto Commands" }, + { k.picker_search_buffer, "Telescope current_buffer_fuzzy_find", desc = "Buffer" }, + { k.picker_search_command_history, "Telescope command_history", desc = "Command History" }, + { k.picker_search_commands, "Telescope commands", desc = "Commands" }, + { k.picker_search_document_diagnostics, "Telescope diagnostics bufnr=0", desc = "Document Diagnostics" }, + { k.picker_search_workspace_diagnostics, "Telescope diagnostics", desc = "Workspace Diagnostics" }, + { k.picker_search_grep_root, LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, + { k.picker_search_grep_cwd, LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, + { k.picker_search_help_pages, "Telescope help_tags", desc = "Help Pages" }, + { k.picker_search_highlight_groups, "Telescope highlights", desc = "Search Highlight Groups" }, + { k.picker_search_jumplist, "Telescope jumplist", desc = "Jumplist" }, + { k.picker_search_keymaps, "Telescope keymaps", desc = "Key Maps" }, + { k.picker_search_loclist, "Telescope loclist", desc = "Location List" }, + { k.picker_search_man_pages, "Telescope man_pages", desc = "Man Pages" }, + { k.picker_search_marks, "Telescope marks", desc = "Jump to Mark" }, + { k.picker_search_options, "Telescope vim_options", desc = "Options" }, + { k.picker_search_resume, "Telescope resume", desc = "Resume" }, + { k.picker_search_quickfix, "Telescope quickfix", desc = "Quickfix List" }, + { k.picker_search_word_root, LazyVim.pick("grep_string", { word_match = "-w" }), desc = "Word (Root Dir)" }, { - k.colorscheme_preview, + k.picker_search_word_cwd, + LazyVim.pick("grep_string", { root = false, word_match = "-w" }), + desc = "Word (cwd)", + }, + { k.picker_search_selection_root, LazyVim.pick("grep_string"), mode = "v", desc = "Selection (Root Dir)" }, + { + k.picker_search_selection_cwd, + LazyVim.pick("grep_string", { root = false }), + mode = "v", + desc = "Selection (cwd)", + }, + { + k.picker_colorscheme_preview, LazyVim.pick("colorscheme", { enable_preview = true }), desc = "Colorscheme with Preview", }, { - k.go_to_symbol, + k.picker_go_to_symbol, function() require("telescope.builtin").lsp_document_symbols({ symbols = LazyVim.config.get_kind_filter(), @@ -147,7 +154,7 @@ return { desc = "Goto Symbol", }, { - k.go_to_symbol_workspace, + k.picker_go_to_symbol_workspace, function() require("telescope.builtin").lsp_dynamic_workspace_symbols({ symbols = LazyVim.config.get_kind_filter(), @@ -189,17 +196,17 @@ return { local keymaps = { i = { - { k.actions.open_with_trouble, open_with_trouble }, - { k.actions.open_with_trouble_alt, open_with_trouble }, - { k.actions.find_files_no_ignore, find_files_no_ignore }, - { k.actions.find_files_with_hidden, find_files_with_hidden }, - { k.actions.cycle_history_next, actions.cycle_history_next }, - { k.actions.cycle_history_prev, actions.cycle_history_prev }, - { k.actions.preview_scrolling_down, actions.preview_scrolling_down }, - { k.actions.preview_scrolling_up, actions.preview_scrolling_up }, + { k.picker_open_with_trouble, open_with_trouble }, + { k.picker_open_with_trouble_alt, open_with_trouble }, + { k.picker_find_files_no_ignore, find_files_no_ignore }, + { k.picker_find_files_with_hidden, find_files_with_hidden }, + { k.picker_cycle_history_next, actions.cycle_history_next }, + { k.picker_cycle_history_prev, actions.cycle_history_prev }, + { k.picker_preview_scrolling_down, actions.preview_scrolling_down }, + { k.picker_preview_scrolling_up, actions.preview_scrolling_up }, }, n = { - { k.actions.close, actions.close }, + { k.picker_close, actions.close }, }, } local mappings = { @@ -273,8 +280,8 @@ return { end opts.defaults = vim.tbl_deep_extend("force", opts.defaults or {}, { mappings = { - n = k.flash.normal == "" and {} or { [k.flash.normal] = flash }, - i = k.flash.insert == "" and {} or { [k.flash.insert] = flash }, + n = k.flash_normal == "" and {} or { [k.flash_normal] = flash }, + i = k.flash_insert == "" and {} or { [k.flash_insert] = flash }, }, }) end, @@ -310,10 +317,10 @@ return { local Keys = require("lazyvim.plugins.lsp.keymaps").get() -- stylua: ignore vim.list_extend(Keys, { - { lang.go_to_definition, function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, - { lang.references, "Telescope lsp_references", desc = "References", nowait = true }, - { lang.go_to_implementation, function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" }, - { lang.go_to_type_definition, function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" }, + { k.lang_go_to_definition, function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" }, + { k.lang_references, "Telescope lsp_references", desc = "References", nowait = true }, + { k.lang_go_to_implementation, function() require("telescope.builtin").lsp_implementations({ reuse_win = true }) end, desc = "Goto Implementation" }, + { k.lang_go_to_type_definition, function() require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) end, desc = "Goto T[y]pe Definition" }, }) end, }, diff --git a/lua/lazyvim/plugins/extras/lang/ansible.lua b/lua/lazyvim/plugins/extras/lang/ansible.lua index 315494f2..b4b02b9e 100644 --- a/lua/lazyvim/plugins/extras/lang/ansible.lua +++ b/lua/lazyvim/plugins/extras/lang/ansible.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.ansible +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua index 0272a47e..041a36ad 100644 --- a/lua/lazyvim/plugins/extras/lang/clangd.lua +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.clangd +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() return LazyVim.extras.wants({ @@ -59,8 +59,11 @@ return { -- Ensure mason installs the server clangd = { keys = { - k.switch_source_header == "" and {} - or { k.switch_source_header, "ClangdSwitchSourceHeader", desc = "Switch Source/Header (C/C++)" }, + k.clangd_switch_source_header == "" and {} or { + k.clangd_switch_source_header, + "ClangdSwitchSourceHeader", + desc = "Switch Source/Header (C/C++)", + }, }, root_dir = function(fname) return require("lspconfig.util").root_pattern( diff --git a/lua/lazyvim/plugins/extras/lang/clojure.lua b/lua/lazyvim/plugins/extras/lang/clojure.lua index 9c6c6adc..fee01ece 100644 --- a/lua/lazyvim/plugins/extras/lang/clojure.lua +++ b/lua/lazyvim/plugins/extras/lang/clojure.lua @@ -1,5 +1,5 @@ local map = LazyVim.keymap_set -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.clojure +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -80,13 +80,13 @@ return { map( { "n", "v" }, - k.jump_prev_evaluation_output, + k.clojure_jump_prev_evaluation_output, "call search('^; -\\+$', 'bw')", { silent = true, buffer = true, desc = "Jumps to the beginning of previous evaluation output." } ) map( { "n", "v" }, - k.jump_next_evaluation_output, + k.clojure_jump_next_evaluation_output, "call search('^; -\\+$', 'w')", { silent = true, buffer = true, desc = "Jumps to the beginning of next evaluation output." } ) diff --git a/lua/lazyvim/plugins/extras/lang/elixir.lua b/lua/lazyvim/plugins/extras/lang/elixir.lua index 3a558db6..31dc8503 100644 --- a/lua/lazyvim/plugins/extras/lang/elixir.lua +++ b/lua/lazyvim/plugins/extras/lang/elixir.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.elixir +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -14,7 +14,7 @@ return { elixirls = { keys = { { - k.to_pipe, + k.elixir_to_pipe, function() local params = vim.lsp.util.make_position_params() LazyVim.lsp.execute({ @@ -25,7 +25,7 @@ return { desc = "To Pipe", }, { - k.from_pipe, + k.elixir_from_pipe, function() local params = vim.lsp.util.make_position_params() LazyVim.lsp.execute({ diff --git a/lua/lazyvim/plugins/extras/lang/java.lua b/lua/lazyvim/plugins/extras/lang/java.lua index de59ab85..59d4b469 100644 --- a/lua/lazyvim/plugins/extras/lang/java.lua +++ b/lua/lazyvim/plugins/extras/lang/java.lua @@ -1,7 +1,6 @@ -- This is the same as in lspconfig.configs.jdtls, but avoids -- needing to require that when this module loads. -local k = require("lazyvim.keymaps").get_keymaps().extras.lang -local t = require("lazyvim.keymaps").get_keymaps().extras.test.core +local k = require("lazyvim.keymaps").get_keymaps() local java_filetypes = { "java" } @@ -197,31 +196,32 @@ return { { mode = "n", buffer = args.buf, - { k.extract.prefix, group = "extract" }, - { k.extract.variable, require("jdtls").extract_variable_all, desc = "Extract Variable" }, - { k.extract.constant, require("jdtls").extract_constant, desc = "Extract Constant" }, - { k.go_to_super, require("jdtls").super_implementation, desc = "Goto Super" }, - { k.go_to_subjects, require("jdtls.tests").goto_subjects, desc = "Goto Subjects" }, - { k.organize_imports, require("jdtls").organize_imports, desc = "Organize Imports" }, + { k.lang_extract_prefix, group = "extract" }, + { k.lang_extract_variable, require("jdtls").extract_variable_all, desc = "Extract Variable" }, + { k.lang_extract_constant, require("jdtls").extract_constant, desc = "Extract Constant" }, + { k.lang_go_to_super, require("jdtls").super_implementation, desc = "Goto Super" }, + { k.lang_go_to_subjects, require("jdtls.tests").goto_subjects, desc = "Goto Subjects" }, + { k.lang_organize_imports, require("jdtls").organize_imports, desc = "Organize Imports" }, }, }) wk.add({ { mode = "v", buffer = args.buf, - { k.extract.prefix, group = "extract" }, + { k.lang_extract_prefix, group = "extract" }, { - k.extract.method, + k.lang_extract_method, [[lua require('jdtls').extract_method(true)]], desc = "Extract Method", }, { - k.extract.variable, + k.lang_extract_variable, [[lua require('jdtls').extract_variable_all(true)]], desc = "Extract Variable", }, { - k.extract.constant([[lua require('jdtls').extract_constant(true)]]), + k.lang_extract_constant, + [[lua require('jdtls').extract_constant(true)]], desc = "Extract Constant", }, }, @@ -239,9 +239,9 @@ return { { mode = "n", buffer = args.buf, - { t.prefix, group = "test" }, + { k.test_prefix, group = "test" }, { - t.run_all_test_files, + k.test_run_all_test_files, function() require("jdtls.dap").test_class({ config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, @@ -250,7 +250,7 @@ return { desc = "Run All Test", }, { - t.run_nearest, + k.test_run_nearest, function() require("jdtls.dap").test_nearest_method({ config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil, @@ -258,7 +258,7 @@ return { end, desc = "Run Nearest Test", }, - { t.run_file, require("jdtls.dap").pick_test, desc = "Run Test" }, + { k.test_run_file, require("jdtls.dap").pick_test, desc = "Run Test" }, }, }) end diff --git a/lua/lazyvim/plugins/extras/lang/lean.lua b/lua/lazyvim/plugins/extras/lang/lean.lua index a510161e..11f3169b 100644 --- a/lua/lazyvim/plugins/extras/lang/lean.lua +++ b/lua/lazyvim/plugins/extras/lang/lean.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.lean +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -62,7 +62,7 @@ return { }, -- Change if you don't like the backslash -- (comma is a popular choice on French keyboards) - leader = k.abbreviations_leader, + leader = k.lean_abbreviations_leader, }, -- Enable suggested mappings? diff --git a/lua/lazyvim/plugins/extras/lang/markdown.lua b/lua/lazyvim/plugins/extras/lang/markdown.lua index a1d31082..31901ccf 100644 --- a/lua/lazyvim/plugins/extras/lang/markdown.lua +++ b/lua/lazyvim/plugins/extras/lang/markdown.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.markdown +local k = require("lazyvim.keymaps").get_keymaps() LazyVim.on_very_lazy(function() vim.filetype.add({ @@ -110,7 +110,7 @@ return { ft = { "markdown", "norg", "rmd", "org" }, config = function(_, opts) require("render-markdown").setup(opts) - LazyVim.toggle.map(k.render_markdown_toggle, { + LazyVim.toggle.map(k.markdown_render_markdown_toggle, { name = "Render Markdown", get = function() return require("render-markdown.state").enabled diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua index 2c55dc6b..d89d1b0c 100644 --- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua +++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang +local k = require("lazyvim.keymaps") return { recommended = function() @@ -53,7 +53,7 @@ return { }, keys = { { - k.go_to_definition, + k.lang_go_to_definition, LazyVim.has("telescope.nvim") and function() require("omnisharp_extended").telescope_lsp_definitions() end or function() diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 224e0879..785e5923 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang +local k = require("lazyvim.keymaps").get_keymaps() if lazyvim_docs then -- LSP Server to use for Python. @@ -42,7 +42,7 @@ return { }, keys = { { - k.organize_imports, + k.lang_organize_imports, LazyVim.lsp.action["source.organizeImports"], desc = "Organize Imports", }, @@ -51,7 +51,7 @@ return { ruff_lsp = { keys = { { - k.organize_imports, + k.lang_organize_imports, LazyVim.lsp.action["source.organizeImports"], desc = "Organize Imports", }, @@ -101,8 +101,8 @@ return { "mfussenegger/nvim-dap-python", -- stylua: ignore keys = { - { k.python.debug_method, function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" }, - { k.python.debug_class, function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" }, + { k.python_debug_method, function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" }, + { k.python_debug_class, function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" }, }, config = function() if vim.fn.has("win32") == 1 then @@ -130,7 +130,7 @@ return { }, -- Call config for python files and load the cached venv automatically ft = "python", - keys = { { k.python.select_virtual_env, ":VenvSelect", desc = "Select VirtualEnv", ft = "python" } }, + keys = { { k.python_select_virtual_env, ":VenvSelect", desc = "Select VirtualEnv", ft = "python" } }, }, { diff --git a/lua/lazyvim/plugins/extras/lang/r.lua b/lua/lazyvim/plugins/extras/lang/r.lua index 9f3038ce..96eb4ac8 100644 --- a/lua/lazyvim/plugins/extras/lang/r.lua +++ b/lua/lazyvim/plugins/extras/lang/r.lua @@ -1,5 +1,5 @@ local map = LazyVim.keymap_set -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.r +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -19,25 +19,25 @@ return { -- This function will be called at the FileType event -- of files supported by R.nvim. This is an -- opportunity to create mappings local to buffers. - map("n", k.send, "RDSendLine", { buffer = true }) - map("v", k.send, "RSendSelection", { buffer = true }) + map("n", k.r_send, "RDSendLine", { buffer = true }) + map("v", k.r_send, "RSendSelection", { buffer = true }) local wk = require("which-key") wk.add({ buffer = true, - { k.send_all, group = "all" }, - { k.send_between_marks, group = "between marks" }, - { k.send_chunks, group = "chunks" }, - { k.send_functions, group = "functions" }, - { k.send_goto, group = "goto" }, - { k.send_install, group = "install" }, - { k.send_knit, group = "knit" }, - { k.send_paragraph, group = "paragraph" }, - { k.send_quarto, group = "quarto" }, - { k.send_general, group = "r general" }, - { k.send_split_or_send, group = "split or send" }, - { k.send_terminal, group = "terminal" }, - { k.send_view, group = "view" }, + { k.r_send_all, group = "all" }, + { k.r_send_between_marks, group = "between marks" }, + { k.r_send_chunks, group = "chunks" }, + { k.r_send_functions, group = "functions" }, + { k.r_send_goto, group = "goto" }, + { k.r_send_install, group = "install" }, + { k.r_send_knit, group = "knit" }, + { k.r_send_paragraph, group = "paragraph" }, + { k.r_send_quarto, group = "quarto" }, + { k.r_send_general, group = "r general" }, + { k.r_send_split_or_send, group = "split or send" }, + { k.r_send_terminal, group = "terminal" }, + { k.r_send_view, group = "view" }, }) end, }, diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index c6f4e04e..a97962dc 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -1,5 +1,5 @@ local map = LazyVim.keymap_set -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.rust +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -51,10 +51,10 @@ return { opts = { server = { on_attach = function(_, bufnr) - map("n", k.code_action, function() + map("n", k.rust_code_action, function() vim.cmd.RustLsp("codeAction") end, { desc = "Code Action", buffer = bufnr }) - map("n", k.debuggables, function() + map("n", k.rust_debuggables, function() vim.cmd.RustLsp("debuggables") end, { desc = "Rust Debuggables", buffer = bufnr }) end, @@ -101,7 +101,7 @@ return { taplo = { keys = { { - k.show_crate_documentation, + k.rust_show_crate_documentation, function() if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then require("crates").show_popup() diff --git a/lua/lazyvim/plugins/extras/lang/scala.lua b/lua/lazyvim/plugins/extras/lang/scala.lua index 51493555..e05b96fd 100644 --- a/lua/lazyvim/plugins/extras/lang/scala.lua +++ b/lua/lazyvim/plugins/extras/lang/scala.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.scala +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -23,14 +23,14 @@ return { metals = { keys = { { - k.metals_commands, + k.scala_metals_commands, function() require("telescope").extensions.metals.commands() end, desc = "Metals commands", }, { - k.metals_compile_cascade, + k.scala_metals_compile_cascade, function() require("metals").compile_cascade() end, diff --git a/lua/lazyvim/plugins/extras/lang/sql.lua b/lua/lazyvim/plugins/extras/lang/sql.lua index 88dceb1d..3e3dd274 100644 --- a/lua/lazyvim/plugins/extras/lang/sql.lua +++ b/lua/lazyvim/plugins/extras/lang/sql.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.sql +local k = require("lazyvim.keymaps").get_keymaps() if lazyvim_docs then -- The setup below will automatically configure connections without the need for manual input each time. @@ -73,7 +73,7 @@ return { cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" }, dependencies = "vim-dadbod", keys = { - { k.toggle_dbui, "DBUIToggle", desc = "Toggle DBUI" }, + { k.sql_toggle_dbui, "DBUIToggle", desc = "Toggle DBUI" }, }, init = function() local data_path = vim.fn.stdpath("data") diff --git a/lua/lazyvim/plugins/extras/lang/svelte.lua b/lua/lazyvim/plugins/extras/lang/svelte.lua index 541a5ba2..dc65c789 100644 --- a/lua/lazyvim/plugins/extras/lang/svelte.lua +++ b/lua/lazyvim/plugins/extras/lang/svelte.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -28,7 +28,7 @@ return { svelte = { keys = { { - k.organize_imports, + k.lang_organize_imports, LazyVim.lsp.action["source.organizeImports"], desc = "Organize Imports", }, diff --git a/lua/lazyvim/plugins/extras/lang/tex.lua b/lua/lazyvim/plugins/extras/lang/tex.lua index e86dc1c7..c73e1da7 100644 --- a/lua/lazyvim/plugins/extras/lang/tex.lua +++ b/lua/lazyvim/plugins/extras/lang/tex.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang.tex +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -32,7 +32,7 @@ return { vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog" end, keys = { - { k.prefix, "", desc = "+vimtex" }, + { k.tex_prefix, "", desc = "+vimtex" }, }, }, @@ -44,7 +44,7 @@ return { servers = { texlab = { keys = { - { k.vimtex_docs, "(vimtex-doc-package)", desc = "Vimtex Docs", silent = true }, + { k.tex_vimtex_docs, "(vimtex-doc-package)", desc = "Vimtex Docs", silent = true }, }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 543288c2..60ef2c95 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = function() @@ -68,7 +68,7 @@ return { }, keys = { { - k.typescript.go_to_source_definition, + k.typescript_go_to_source_definition, function() local params = vim.lsp.util.make_position_params() LazyVim.lsp.execute({ @@ -80,7 +80,7 @@ return { desc = "Goto Source Definition", }, { - k.file_references, + k.lang_file_references, function() LazyVim.lsp.execute({ command = "typescript.findAllFileReferences", @@ -91,27 +91,27 @@ return { desc = "File References", }, { - k.organize_imports, + k.lang_organize_imports, LazyVim.lsp.action["source.organizeImports"], desc = "Organize Imports", }, { - k.add_missing_imports, + k.lang_add_missing_imports, LazyVim.lsp.action["source.addMissingImports.ts"], desc = "Add missing imports", }, { - k.remove_unused_imports, + k.lang_remove_unused_imports, LazyVim.lsp.action["source.removeUnused.ts"], desc = "Remove unused imports", }, { - k.fix_all_diagnostics, + k.lang_fix_all_diagnostics, LazyVim.lsp.action["source.fixAll.ts"], desc = "Fix all diagnostics", }, { - k.select_lang_version, + k.lang_select_lang_version, function() LazyVim.lsp.execute({ command = "typescript.selectTypeScriptVersion" }) end, diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua index a9ca16bf..165effdd 100644 --- a/lua/lazyvim/plugins/extras/test/core.lua +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.test.core +local k = require("lazyvim.keymaps").get_keymaps() return { recommended = true, @@ -107,16 +107,16 @@ return { end, -- stylua: ignore keys = { - { k.prefix, "", desc = "+test"}, - { k.run_file, function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, - { k.run_all_test_files, function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files" }, - { k.run_nearest, function() require("neotest").run.run() end, desc = "Run Nearest" }, - { k.run_last, function() require("neotest").run.run_last() end, desc = "Run Last" }, - { k.toggle_summary, function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, - { k.show_output, function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, - { k.toggle_output_panel, function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, - { k.stop, function() require("neotest").run.stop() end, desc = "Stop" }, - { k.toggle_watch, function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch" }, + { k.test_prefix, "", desc = "+test"}, + { k.test_run_file, function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, + { k.test_run_all_test_files, function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files" }, + { k.test_run_nearest, function() require("neotest").run.run() end, desc = "Run Nearest" }, + { k.test_run_last, function() require("neotest").run.run_last() end, desc = "Run Last" }, + { k.test_toggle_summary, function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, + { k.test_show_output, function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, + { k.test_toggle_output_panel, function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, + { k.test_stop, function() require("neotest").run.stop() end, desc = "Stop" }, + { k.test_toggle_watch, function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch" }, }, }, { @@ -124,7 +124,7 @@ return { optional = true, -- stylua: ignore keys = { - { k.debug_nearest, function() require("neotest").run.run({strategy = "dap"}) end, desc = "Debug Nearest" }, + { k.test_debug_nearest, function() require("neotest").run.run({strategy = "dap"}) end, desc = "Debug Nearest" }, }, }, } diff --git a/lua/lazyvim/plugins/extras/ui/alpha.lua b/lua/lazyvim/plugins/extras/ui/alpha.lua index f60ba1bc..e8927ccb 100644 --- a/lua/lazyvim/plugins/extras/ui/alpha.lua +++ b/lua/lazyvim/plugins/extras/ui/alpha.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().ui.dashboard +local k = require("lazyvim.keymaps").get_keymaps() return { @@ -26,15 +26,15 @@ return { -- stylua: ignore dashboard.section.buttons.val = {} local actions = { - { k.find_file, " " .. " Find file", LazyVim.pick() }, - { k.new_file, " " .. " New file", [[ ene startinsert ]] }, - { k.recent_files, " " .. " Recent files", LazyVim.pick("oldfiles") }, - { k.find_text, " " .. " Find text", LazyVim.pick("live_grep") }, - { k.config, " " .. " Config", LazyVim.pick.config_files() }, - { k.restore_session, " " .. " Restore Session", [[ lua require("persistence").load() ]] }, - { k.lazy_extras, " " .. " Lazy Extras", " LazyExtras " }, - { k.lazy, "󰒲 " .. " Lazy", " Lazy " }, - { k.quit, " " .. " Quit", " qa " }, + { k.dashboard_find_file, " " .. " Find file", LazyVim.pick() }, + { k.dashboard_new_file, " " .. " New file", [[ ene startinsert ]] }, + { k.dashboard_recent_files, " " .. " Recent files", LazyVim.pick("oldfiles") }, + { k.dashboard_find_text, " " .. " Find text", LazyVim.pick("live_grep") }, + { k.dashboard_config, " " .. " Config", LazyVim.pick.config_files() }, + { k.dashboard_restore_session, " " .. " Restore Session", [[ lua require("persistence").load() ]] }, + { k.dashboard_lazy_extras, " " .. " Lazy Extras", " LazyExtras " }, + { k.dashboard_lazy, "󰒲 " .. " Lazy", " Lazy " }, + { k.dashboard_quit, " " .. " Quit", " qa " }, } for _, action in ipairs(actions) do diff --git a/lua/lazyvim/plugins/extras/ui/edgy.lua b/lua/lazyvim/plugins/extras/ui/edgy.lua index c2cdf077..f9654cab 100644 --- a/lua/lazyvim/plugins/extras/ui/edgy.lua +++ b/lua/lazyvim/plugins/extras/ui/edgy.lua @@ -1,5 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.ui.edgy -local r = require("lazyvim.keymaps").get_keymaps().keymaps.resize_window +local k = require("lazyvim.keymaps").get_keymaps() return { -- edgy @@ -8,32 +7,32 @@ return { event = "VeryLazy", keys = { { - k.toggle, + k.edgy_toggle, function() require("edgy").toggle() end, desc = "Edgy Toggle", }, -- stylua: ignore - { k.select_window, function() require("edgy").select() end, desc = "Edgy Select Window" }, + { k.edgy_select_window, function() require("edgy").select() end, desc = "Edgy Select Window" }, }, opts = function() local keys = {} local actions = { -- increase width - [r.increase_width] = function(win) + [k.size_increase_width] = function(win) win:resize("width", 2) end, -- decrease width - [r.decrease_width] = function(win) + [k.size_decrease_width] = function(win) win:resize("width", -2) end, -- increase height - [r.increase_height] = function(win) + [k.size_increase_height] = function(win) win:resize("height", 2) end, -- decrease height - [r.decrease_height] = function(win) + [k.size_decrease_height] = function(win) win:resize("height", -2) end, } diff --git a/lua/lazyvim/plugins/extras/ui/mini-animate.lua b/lua/lazyvim/plugins/extras/ui/mini-animate.lua index 60d3e620..7055a50d 100644 --- a/lua/lazyvim/plugins/extras/ui/mini-animate.lua +++ b/lua/lazyvim/plugins/extras/ui/mini-animate.lua @@ -1,5 +1,5 @@ -- animations -local k = require("lazyvim.keymaps").get_keymaps().extras.ui.mini_animate +local k = require("lazyvim.keymaps").get_keymaps() return { "echasnovski/mini.animate", @@ -23,7 +23,7 @@ return { end, }) - LazyVim.toggle.map(k.toggle, { + LazyVim.toggle.map(k.minianimae_toggle, { name = "Mini Animate", get = function() return not vim.g.minianimate_disable diff --git a/lua/lazyvim/plugins/extras/ui/treesitter-context.lua b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua index 4e4625fc..63ff430d 100644 --- a/lua/lazyvim/plugins/extras/ui/treesitter-context.lua +++ b/lua/lazyvim/plugins/extras/ui/treesitter-context.lua @@ -1,5 +1,5 @@ -- Show context of the current function -local k = require("lazyvim.keymaps").get_keymaps().extras.ui.treesitter_context +local k = require("lazyvim.keymaps").get_keymaps() return { "nvim-treesitter/nvim-treesitter-context", @@ -7,7 +7,7 @@ return { opts = function() local tsc = require("treesitter-context") - LazyVim.toggle.map(k.toggle, { + LazyVim.toggle.map(k.tscontext_toggle, { name = "Treesitter Context", get = tsc.enabled, set = function(state) diff --git a/lua/lazyvim/plugins/extras/util/chezmoi.lua b/lua/lazyvim/plugins/extras/util/chezmoi.lua index 4d5c62e3..3446710f 100644 --- a/lua/lazyvim/plugins/extras/util/chezmoi.lua +++ b/lua/lazyvim/plugins/extras/util/chezmoi.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.util.chezmoi +local k = require("lazyvim.keymaps").get_keymaps() local pick_chezmoi = function() if LazyVim.pick.picker.name == "telescope" then @@ -37,7 +37,7 @@ return { "xvzc/chezmoi.nvim", keys = { { - k.pick_chezmoi, + k.chezmoi_pick_chezmoi, pick_chezmoi, desc = "Chezmoi", }, @@ -53,7 +53,7 @@ return { on_watch = false, }, telescope = { - select = k.select == "" and {} or { k.select }, + select = k.chezmoi_select == "" and {} or { k.chezmoi_select }, }, }, init = function() @@ -70,7 +70,7 @@ return { "nvimdev/dashboard-nvim", optional = true, opts = function(_, opts) - if not k.key or k.key == "" then + if not k.chezmoi_key or k.chezmoi_key == "" then return opts end @@ -78,7 +78,7 @@ return { action = pick_chezmoi, desc = " Config", icon = "", - key = k.key, + key = k.chezmoi_key, } projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc) diff --git a/lua/lazyvim/plugins/extras/util/gitui.lua b/lua/lazyvim/plugins/extras/util/gitui.lua index fc882f47..eabd3708 100644 --- a/lua/lazyvim/plugins/extras/util/gitui.lua +++ b/lua/lazyvim/plugins/extras/util/gitui.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().keymaps.lazygit +local k = require("lazyvim.keymaps").get_keymaps() return { @@ -8,14 +8,14 @@ return { opts = { ensure_installed = { "gitui" } }, keys = { { - k.toggle_cwd, + k.lazygit_toggle_cwd, function() LazyVim.terminal.open({ "gitui" }, { esc_esc = false, ctrl_hjkl = false }) end, desc = "GitUi (cwd)", }, { - k.toggle_root, + k.lazygit_toggle_root, function() LazyVim.terminal.open({ "gitui" }, { cwd = LazyVim.root.get(), esc_esc = false, ctrl_hjkl = false }) end, diff --git a/lua/lazyvim/plugins/extras/util/octo.lua b/lua/lazyvim/plugins/extras/util/octo.lua index e5c0ecc3..07407bc2 100644 --- a/lua/lazyvim/plugins/extras/util/octo.lua +++ b/lua/lazyvim/plugins/extras/util/octo.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.util.octo +local k = require("lazyvim.keymaps").get_keymaps() return { @@ -17,22 +17,22 @@ return { picker = "telescope", }, keys = { - { k.issue_list, "Octo issue list", desc = "List Issues (Octo)" }, - { k.issue_search, "Octo issue search", desc = "Search Issues (Octo)" }, - { k.pr_list, "Octo pr list", desc = "List PRs (Octo)" }, - { k.pr_search, "Octo pr search", desc = "Search PRs (Octo)" }, - { k.repo_list, "Octo repo list", desc = "List Repos (Octo)" }, - { k.search, "Octo search", desc = "Search (Octo)" }, + { k.octo_issue_list, "Octo issue list", desc = "List Issues (Octo)" }, + { k.octo_issue_search, "Octo issue search", desc = "Search Issues (Octo)" }, + { k.octo_pr_list, "Octo pr list", desc = "List PRs (Octo)" }, + { k.octo_pr_search, "Octo pr search", desc = "Search PRs (Octo)" }, + { k.octo_repo_list, "Octo repo list", desc = "List Repos (Octo)" }, + { k.octo_search, "Octo search", desc = "Search (Octo)" }, - { k.assignee, "", desc = "+assignee (Octo)", ft = "octo" }, - { k.comment_code, "", desc = "+comment/code (Octo)", ft = "octo" }, - { k.label, "", desc = "+label (Octo)", ft = "octo" }, - { k.issue, "", desc = "+issue (Octo)", ft = "octo" }, - { k.react, "", desc = "+react (Octo)", ft = "octo" }, - { k.pr, "", desc = "+pr (Octo)", ft = "octo" }, - { k.review, "", desc = "+review (Octo)", ft = "octo" }, - { k.insert_at, "@", mode = "i", ft = "octo", silent = true }, - { k.insert_hashtag, "#", mode = "i", ft = "octo", silent = true }, + { k.octo_assignee, "", desc = "+assignee (Octo)", ft = "octo" }, + { k.octo_comment_code, "", desc = "+comment/code (Octo)", ft = "octo" }, + { k.octo_label, "", desc = "+label (Octo)", ft = "octo" }, + { k.octo_issue, "", desc = "+issue (Octo)", ft = "octo" }, + { k.octo_react, "", desc = "+react (Octo)", ft = "octo" }, + { k.octo_pr, "", desc = "+pr (Octo)", ft = "octo" }, + { k.octo_review, "", desc = "+review (Octo)", ft = "octo" }, + { k.octo_insert_at, "@", mode = "i", ft = "octo", silent = true }, + { k.octo_insert_hashtag, "#", mode = "i", ft = "octo", silent = true }, }, }, diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 329eeb25..c7d0cb94 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -1,5 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.editor.picker -local d = require("lazyvim.keymaps").get_keymaps().ui.dashboard +local k = require("lazyvim.keymaps").get_keymaps() local pick = nil @@ -104,7 +103,7 @@ return { "nvim-telescope/telescope.nvim", optional = true, keys = { - { k.find_projects, pick, desc = "Projects" }, + { k.picker_find_projects, pick, desc = "Projects" }, }, }, @@ -112,7 +111,7 @@ return { "ibhagwan/fzf-lua", optional = true, keys = { - { k.find_projects, pick, desc = "Projects" }, + { k.picker_find_projects, pick, desc = "Projects" }, }, }, @@ -146,7 +145,7 @@ return { "nvimdev/dashboard-nvim", optional = true, opts = function(_, opts) - if not d.projects or d.projects == "" then + if not k.dashboard_projects or k.dashboard_projects == "" then return opts end @@ -154,7 +153,7 @@ return { action = pick, desc = " Projects", icon = " ", - key = d.projects, + key = k.dashboard_projects, } projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc) diff --git a/lua/lazyvim/plugins/extras/util/rest.lua b/lua/lazyvim/plugins/extras/util/rest.lua index 1dbdc5db..a4ca4b66 100644 --- a/lua/lazyvim/plugins/extras/util/rest.lua +++ b/lua/lazyvim/plugins/extras/util/rest.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.util.rest.kulala +local k = require("lazyvim.keymaps").get_keymaps() vim.filetype.add({ extension = { @@ -10,11 +10,15 @@ return { "mistweaverco/kulala.nvim", ft = "http", keys = { - { k.prefix, "", desc = "+Rest" }, - { k.send_request, "lua require('kulala').run()", desc = "Send the request" }, - { k.toggle_view, "lua require('kulala').toggle_view()", desc = "Toggle headers/body" }, - { k.jump_to_previous_request, "lua require('kulala').jump_prev()", desc = "Jump to previous request" }, - { k.jump_to_next_request, "lua require('kulala').jump_next()", desc = "Jump to next request" }, + { k.kulala_prefix, "", desc = "+Rest" }, + { k.kulala_send_request, "lua require('kulala').run()", desc = "Send the request" }, + { k.kulala_toggle_view, "lua require('kulala').toggle_view()", desc = "Toggle headers/body" }, + { + k.kulala_jump_to_previous_request, + "lua require('kulala').jump_prev()", + desc = "Jump to previous request", + }, + { k.kulala_jump_to_next_request, "lua require('kulala').jump_next()", desc = "Jump to next request" }, }, opts = {}, }, diff --git a/lua/lazyvim/plugins/extras/vscode.lua b/lua/lazyvim/plugins/extras/vscode.lua index 38421997..21007550 100644 --- a/lua/lazyvim/plugins/extras/vscode.lua +++ b/lua/lazyvim/plugins/extras/vscode.lua @@ -29,15 +29,15 @@ Config.options.defaults.cond = function(plugin) end local map = LazyVim.keymap_set -local k = require("lazyvim.keymaps").get_keymaps().extras.vscode +local k = require("lazyvim.keymaps").get_keymaps() -- Add some vscode specific keymaps vim.api.nvim_create_autocmd("User", { pattern = "LazyVimKeymapsDefaults", callback = function() - map("n", k.find, "Find") - map("n", k.find_in_files, [[lua require('vscode').action('workbench.action.findInFiles')]]) - map("n", k.go_to_symbol, [[lua require('vscode').action('workbench.action.gotoSymbol')]]) + map("n", k.vscode_find, "Find") + map("n", k.vscode_find_in_files, [[lua require('vscode').action('workbench.action.findInFiles')]]) + map("n", k.vscode_go_to_symbol, [[lua require('vscode').action('workbench.action.gotoSymbol')]]) end, }) diff --git a/lua/lazyvim/plugins/formatting.lua b/lua/lazyvim/plugins/formatting.lua index 41cf3b91..175ad9ce 100644 --- a/lua/lazyvim/plugins/formatting.lua +++ b/lua/lazyvim/plugins/formatting.lua @@ -1,5 +1,5 @@ local M = {} -local k = require("lazyvim.keymaps").get_keymaps().formatting +local k = require("lazyvim.keymaps").get_keymaps() ---@param opts conform.setupOpts function M.setup(_, opts) @@ -26,7 +26,7 @@ return { cmd = "ConformInfo", keys = { { - k.conform.format, + k.conform_format, function() require("conform").format({ formatters = { "injected" }, timeout_ms = 3000 }) end, diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 4ab4119b..2d3f1572 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().extras.lang +local k = require("lazyvim.keymaps").get_keymaps() return { -- lspconfig { @@ -264,7 +264,7 @@ return { "williamboman/mason.nvim", cmd = "Mason", - keys = { { k.mason, "Mason", desc = "Mason" } }, + keys = { { k.lang_mason, "Mason", desc = "Mason" } }, build = ":MasonUpdate", opts_extend = { "ensure_installed" }, opts = { diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 78779f53..291a2d18 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -1,5 +1,5 @@ local M = {} -local k = require("lazyvim.keymaps").get_keymaps().extras.lang +local k = require("lazyvim.keymaps").get_keymaps() ---@type LazyKeysLspSpec[]|nil M._keys = nil @@ -13,35 +13,41 @@ function M.get() return M._keys end local actions = { - { k.lsp_info, "LspInfo", desc = "Lsp Info" }, - { k.go_to_definition, vim.lsp.buf.definition, desc = "Goto Definition", has = "definition" }, - { k.references, vim.lsp.buf.references, desc = "References", nowait = true }, - { k.go_to_implementation, vim.lsp.buf.implementation, desc = "Goto Implementation" }, - { k.go_to_type_definition, vim.lsp.buf.type_definition, desc = "Goto T[y]pe Definition" }, - { k.go_to_declaration, vim.lsp.buf.declaration, desc = "Goto Declaration" }, - { k.hover, vim.lsp.buf.hover, desc = "Hover" }, - { k.signature_help, vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, - { k.insert_signature_help, vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, - { k.code_action, vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, - { k.run_codelens, vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" }, + { k.lang_lsp_info, "LspInfo", desc = "Lsp Info" }, + { k.lang_go_to_definition, vim.lsp.buf.definition, desc = "Goto Definition", has = "definition" }, + { k.lang_references, vim.lsp.buf.references, desc = "References", nowait = true }, + { k.lang_go_to_implementation, vim.lsp.buf.implementation, desc = "Goto Implementation" }, + { k.lang_go_to_type_definition, vim.lsp.buf.type_definition, desc = "Goto T[y]pe Definition" }, + { k.lang_go_to_declaration, vim.lsp.buf.declaration, desc = "Goto Declaration" }, + { k.lang_hover, vim.lsp.buf.hover, desc = "Hover" }, + { k.lang_signature_help, vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, { - k.refresh_codelens, + k.lang_insert_signature_help, + vim.lsp.buf.signature_help, + mode = "i", + desc = "Signature Help", + has = "signatureHelp", + }, + { k.lang_code_action, vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, + { k.lang_run_codelens, vim.lsp.codelens.run, desc = "Run Codelens", mode = { "n", "v" }, has = "codeLens" }, + { + k.lang_refresh_codelens, vim.lsp.codelens.refresh, desc = "Refresh & Display Codelens", mode = { "n" }, has = "codeLens", }, { - k.rename_file, + k.lang_rename_file, LazyVim.lsp.rename_file, desc = "Rename File", mode = { "n" }, has = { "workspace/didRenameFiles", "workspace/willRenameFiles" }, }, - { k.rename, vim.lsp.buf.rename, desc = "Rename", has = "rename" }, - { k.source_action, LazyVim.lsp.action.source, desc = "Source Action", has = "codeAction" }, + { k.lang_rename, vim.lsp.buf.rename, desc = "Rename", has = "rename" }, + { k.lang_source_action, LazyVim.lsp.action.source, desc = "Source Action", has = "codeAction" }, { - k.next_reference, + k.lang_next_reference, function() LazyVim.lsp.words.jump(vim.v.count1) end, @@ -52,7 +58,7 @@ function M.get() end, }, { - k.prev_reference, + k.lang_prev_reference, function() LazyVim.lsp.words.jump(-vim.v.count1) end, @@ -63,7 +69,7 @@ function M.get() end, }, { - k.cycle_next_reference, + k.lang_cycle_next_reference, function() LazyVim.lsp.words.jump(vim.v.count1, true) end, @@ -74,7 +80,7 @@ function M.get() end, }, { - k.cycle_prev_reference, + k.lang_cycle_prev_reference, function() LazyVim.lsp.words.jump(-vim.v.count1, true) end, diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 47ac8d71..3805f130 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -1,12 +1,12 @@ -local k = require("lazyvim.keymaps").get_keymaps().treesitter +local k = require("lazyvim.keymaps").get_keymaps() return { { "folke/which-key.nvim", opts = { spec = { - { k.decrement_selection, desc = "Decrement Selection", mode = "x" }, - { k.increment_selection, desc = "Increment Selection", mode = { "x", "n" } }, + { k.ts_decrement_selection, desc = "Decrement Selection", mode = "x" }, + { k.ts_increment_selection, desc = "Increment Selection", mode = { "x", "n" } }, }, }, }, @@ -31,8 +31,8 @@ return { end, cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, keys = { - { k.increment_selection, desc = "Increment Selection" }, - { k.decrement_selection, desc = "Decrement Selection", mode = "x" }, + { k.ts_increment_selection, desc = "Increment Selection" }, + { k.ts_decrement_selection, desc = "Decrement Selection", mode = "x" }, }, opts_extend = { "ensure_installed" }, ---@type TSConfig @@ -69,34 +69,37 @@ return { incremental_selection = { enable = true, keymaps = { - init_selection = (k.increment_selection and k.increment_selection ~= "") and k.increment_selection or false, - node_incremental = (k.increment_selection and k.increment_selection ~= "") and k.increment_selection or false, + init_selection = (k.ts_increment_selection and k.ts_increment_selection ~= "") and k.ts_increment_selection + or false, + node_incremental = (k.ts_increment_selection and k.ts_increment_selection ~= "") and k.ts_increment_selection + or false, scope_incremental = false, - node_decremental = (k.decrement_selection and k.decrement_selection ~= "") and k.decrement_selection or false, + node_decremental = (k.ts_decrement_selection and k.ts_decrement_selection ~= "") and k.ts_decrement_selection + or false, }, }, textobjects = { move = { enable = true, goto_next_start = { - [k.textobjects.goto_next_start.function_outer] = "@function.outer", - [k.textobjects.goto_next_start.class_outer] = "@class.outer", - [k.textobjects.goto_next_start.parameter_inner] = "@parameter.inner", + [k.ts_ns_function_outer] = "@function.outer", + [k.ts_ns_class_outer] = "@class.outer", + [k.ts_ns_parameter_inner] = "@parameter.inner", }, goto_next_end = { - [k.textobjects.goto_next_end.function_outer] = "@function.outer", - [k.textobjects.goto_next_end.class_outer] = "@class.outer", - [k.textobjects.goto_next_end.parameter_inner] = "@parameter.inner", + [k.ts_ne_function_outer] = "@function.outer", + [k.ts_ne_class_outer] = "@class.outer", + [k.ts_ne_parameter_inner] = "@parameter.inner", }, goto_previous_start = { - [k.textobjects.goto_previous_start.function_outer] = "@function.outer", - [k.textobjects.goto_previous_start.class_outer] = "@class.outer", - [k.textobjects.goto_previous_start.parameter_inner] = "@parameter.inner", + [k.ts_ps_function_outer] = "@function.outer", + [k.ts_ps_class_outer] = "@class.outer", + [k.ts_ps_parameter_inner] = "@parameter.inner", }, goto_previous_end = { - [k.textobjects.goto_previous_end.function_outer] = "@function.outer", - [k.textobjects.goto_previous_end.class_outer] = "@class.outer", - [k.textobjects.goto_previous_end.parameter_inner] = "@parameter.inner", + [k.ts_pe_function_outer] = "@function.outer", + [k.ts_pe_class_outer] = "@class.outer", + [k.ts_pe_parameter_inner] = "@parameter.inner", }, }, }, diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index dfd04145..26fcd1a6 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().ui +local k = require("lazyvim.keymaps").get_keymaps() return { -- Better `vim.notify()` @@ -6,7 +6,7 @@ return { "rcarriga/nvim-notify", keys = { { - k.nvim_notify.dismiss_all_notifications, + k.nvimnotify_dismiss_all_notifications, function() require("notify").dismiss({ silent = true, pending = true }) end, @@ -42,29 +42,29 @@ return { "akinsho/bufferline.nvim", event = "VeryLazy", keys = { - { k.bufferline.toggle_pin, "BufferLineTogglePin", desc = "Toggle Pin" }, + { k.bufferline_toggle_pin, "BufferLineTogglePin", desc = "Toggle Pin" }, { - k.bufferline.delete_non_pinned_buffers, + k.bufferline_delete_non_pinned_buffers, "BufferLineGroupClose ungrouped", desc = "Delete Non-Pinned Buffers", }, - { k.bufferline.delete_other_buffers, "BufferLineCloseOthers", desc = "Delete Other Buffers" }, + { k.bufferline_delete_other_buffers, "BufferLineCloseOthers", desc = "Delete Other Buffers" }, { - k.bufferline.delete_buffers_to_the_right, + k.bufferline_delete_buffers_to_the_right, "BufferLineCloseRight", desc = "Delete Buffers to the Right", }, { - k.bufferline.delete_buffers_to_the_left, + k.bufferline_delete_buffers_to_the_left, "BufferLineCloseLeft", desc = "Delete Buffers to the Left", }, - { k.bufferline.prev_buffer, "BufferLineCyclePrev", desc = "Prev Buffer" }, - { k.bufferline.next_buffer, "BufferLineCycleNext", desc = "Next Buffer" }, - { k.bufferline.prev_buffer_alt, "BufferLineCyclePrev", desc = "Prev Buffer" }, - { k.bufferline.next_buffer_alt, "BufferLineCycleNext", desc = "Next Buffer" }, - { k.bufferline.move_buffer_prev, "BufferLineMovePrev", desc = "Move buffer prev" }, - { k.bufferline.move_buffer_next, "BufferLineMoveNext", desc = "Move buffer next" }, + { k.bufferline_prev_buffer, "BufferLineCyclePrev", desc = "Prev Buffer" }, + { k.bufferline_next_buffer, "BufferLineCycleNext", desc = "Next Buffer" }, + { k.bufferline_prev_buffer_alt, "BufferLineCyclePrev", desc = "Prev Buffer" }, + { k.bufferline_next_buffer_alt, "BufferLineCycleNext", desc = "Next Buffer" }, + { k.bufferline_move_buffer_prev, "BufferLineMovePrev", desc = "Move buffer prev" }, + { k.bufferline_move_buffer_next, "BufferLineMoveNext", desc = "Move buffer next" }, }, opts = { options = { @@ -240,7 +240,7 @@ return { "lukas-reineke/indent-blankline.nvim", event = "LazyFile", opts = function() - LazyVim.toggle.map(k.indent_blankline.toggle, { + LazyVim.toggle.map(k.indentblankline_toggle, { name = "Indention Guides", get = function() return require("ibl.config").get_config(0).enabled @@ -309,15 +309,15 @@ return { }, -- stylua: ignore keys = { - { k.noice.prefix, "", desc = "+noice"}, - { k.noice.redirect_cmdline, function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, - { k.noice.last_message, function() require("noice").cmd("last") end, desc = "Noice Last Message" }, - { k.noice.history, function() require("noice").cmd("history") end, desc = "Noice History" }, - { k.noice.all, function() require("noice").cmd("all") end, desc = "Noice All" }, - { k.noice.dismiss, function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, - { k.noice.pick, function() require("noice").cmd("pick") end, desc = "Noice Picker (Telescope/FzfLua)" }, - { k.noice.scroll_forward, function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll Forward", mode = {"i", "n", "s"} }, - { k.noice.scroll_backward, function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll Backward", mode = {"i", "n", "s"}}, + { k.noice_prefix, "", desc = "+noice"}, + { k.noice_redirect_cmdline, function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, + { k.noice_last_message, function() require("noice").cmd("last") end, desc = "Noice Last Message" }, + { k.noice_history, function() require("noice").cmd("history") end, desc = "Noice History" }, + { k.noice_all, function() require("noice").cmd("all") end, desc = "Noice All" }, + { k.noice_dismiss, function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, + { k.noice_pick, function() require("noice").cmd("pick") end, desc = "Noice Picker (Telescope/FzfLua)" }, + { k.noice_scroll_forward, function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll Forward", mode = {"i", "n", "s"} }, + { k.noice_scroll_backward, function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll Backward", mode = {"i", "n", "s"}}, }, config = function(_, opts) -- HACK: noice shows messages from before it was enabled, @@ -374,49 +374,49 @@ return { action = "lua LazyVim.pick()()", desc = " Find File", icon = " ", - key = k.dashboard.find_file, + key = k.dashboard_find_file, }, { action = "ene | startinsert", desc = " New File", icon = " ", - key = k.dashboard.new_file, + key = k.dashboard_new_file, }, { action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", - key = k.dashboard.recent_files, + key = k.dashboard_recent_files, }, { action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", - key = k.dashboard.find_text, + key = k.dashboard_find_text, }, { - action = "lua LazyVim.pick.config_files()()", + action = "lua LazyVim.pick()()", desc = " Config", icon = " ", - key = k.dashboard.config, + key = k.dashboard_config, }, { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", - key = k.dashboard.restore_session, + key = k.dashboard_restore_session, }, { action = "LazyExtras", desc = " Lazy Extras", icon = " ", - key = k.dashboard.lazy_extras, + key = k.dashboard_lazy_extras, }, { action = "Lazy", desc = " Lazy", icon = "󰒲 ", - key = k.dashboard.lazy, + key = k.dashboard_lazy, }, { action = function() @@ -424,7 +424,7 @@ return { end, desc = " Quit", icon = " ", - key = k.dashboard.quit, + key = k.dashboard_quit, }, } diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index 4a0f328c..eb0a6a10 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().util.persistence +local k = require("lazyvim.keymaps").get_keymaps() return { @@ -11,10 +11,10 @@ return { opts = {}, -- stylua: ignore keys = { - { k.restore_session, function() require("persistence").load() end, desc = "Restore Session" }, - { k.select_session, function() require("persistence").select() end,desc = "Select Session" }, - { k.restore_last_session, function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" }, - { k.skip_current_session, function() require("persistence").stop() end, desc = "Don't Save Current Session" }, + { k.persistence_restore_session, function() require("persistence").load() end, desc = "Restore Session" }, + { k.persistence_select_session, function() require("persistence").select() end,desc = "Select Session" }, + { k.persistence_restore_last_session, function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" }, + { k.persistence_skip_current_session, function() require("persistence").stop() end, desc = "Don't Save Current Session" }, }, }, diff --git a/lua/lazyvim/util/mini.lua b/lua/lazyvim/util/mini.lua index fb79f3cb..ed00b771 100644 --- a/lua/lazyvim/util/mini.lua +++ b/lua/lazyvim/util/mini.lua @@ -1,4 +1,4 @@ -local k = require("lazyvim.keymaps").get_keymaps().util.mini_pairs +local k = require("lazyvim.keymaps").get_keymaps() ---@class lazyvim.util.mini local M = {} @@ -123,7 +123,7 @@ end ---@param opts {skip_next: string, skip_ts: string[], skip_unbalanced: boolean, markdown: boolean} function M.pairs(opts) - LazyVim.toggle.map(k.toggle, { + LazyVim.toggle.map(k.minipairs_toggle, { name = "Mini Pairs", get = function() return not vim.g.minipairs_disable