From 5b785f7d2ab1ebc543786b1bf2a5c23440b461f3 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:22:51 +0800 Subject: [PATCH 01/15] feat(keymap): improve structure and documentations (#1395) This is basically a follow-up for #1363! I combined builtin & plugin keymaps, cleaned up some comments (lol "suckless"), and made `ui.lua` export-ready Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- lua/keymap/editor.lua | 242 +++++++++++++++++++++--------------------- lua/keymap/ui.lua | 131 +++++++++++++---------- 2 files changed, 198 insertions(+), 175 deletions(-) diff --git a/lua/keymap/editor.lua b/lua/keymap/editor.lua index e14f4c4a6..8c8c8cd30 100644 --- a/lua/keymap/editor.lua +++ b/lua/keymap/editor.lua @@ -5,136 +5,136 @@ local map_cmd = bind.map_cmd local map_callback = bind.map_callback local et = bind.escape_termcode -local builtin_map = { - -- Builtin: save & quit - ["n|"] = map_cu("write"):with_noremap():with_silent():with_desc("edit: Save file"), - ["n|"] = map_cr("wq"):with_desc("edit: Save file and quit"), - ["n|"] = map_cr("q!"):with_desc("edit: Force quit"), +local mappings = { + builtins = { + -- Builtins: Save & Quit + ["n|"] = map_cu("write"):with_noremap():with_silent():with_desc("edit: Save file"), + ["n|"] = map_cr("wq"):with_desc("edit: Save file and quit"), + ["n|"] = map_cr("q!"):with_desc("edit: Force quit"), - -- Builtin: insert mode - ["i|"] = map_cmd("u"):with_noremap():with_desc("edit: Delete previous block"), - ["i|"] = map_cmd(""):with_noremap():with_desc("edit: Move cursor to left"), - ["i|"] = map_cmd("^i"):with_noremap():with_desc("edit: Move cursor to line start"), - ["i|"] = map_cmd(":w"):with_desc("edit: Save file"), - ["i|"] = map_cmd(":wq"):with_desc("edit: Save file and quit"), + -- Builtins: Insert mode + ["i|"] = map_cmd("u"):with_noremap():with_desc("edit: Delete previous block"), + ["i|"] = map_cmd(""):with_noremap():with_desc("edit: Move cursor to left"), + ["i|"] = map_cmd("^i"):with_noremap():with_desc("edit: Move cursor to line start"), + ["i|"] = map_cmd(":w"):with_desc("edit: Save file"), + ["i|"] = map_cmd(":wq"):with_desc("edit: Save file and quit"), - -- Builtin: command mode - ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Left"), - ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Right"), - ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Home"), - ["c|"] = map_cmd(""):with_noremap():with_desc("edit: End"), - ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Delete"), - ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Backspace"), - ["c|"] = map_cmd([[=expand("%:p:h") . "/" ]]) - :with_noremap() - :with_desc("edit: Complete path of current file"), + -- Builtins: Command mode + ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Left"), + ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Right"), + ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Home"), + ["c|"] = map_cmd(""):with_noremap():with_desc("edit: End"), + ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Delete"), + ["c|"] = map_cmd(""):with_noremap():with_desc("edit: Backspace"), + ["c|"] = map_cmd([[=expand("%:p:h") . "/" ]]) + :with_noremap() + :with_desc("edit: Complete path of current file"), - -- Builtin: visual mode - ["v|J"] = map_cmd(":m '>+1gv=gv"):with_desc("edit: Move this line down"), - ["v|K"] = map_cmd(":m '<-2gv=gv"):with_desc("edit: Move this line up"), - ["v|<"] = map_cmd(""] = map_cmd(">gv"):with_desc("edit: Increase indent"), + -- Builtins: Visual mode + ["v|J"] = map_cmd(":m '>+1gv=gv"):with_desc("edit: Move this line down"), + ["v|K"] = map_cmd(":m '<-2gv=gv"):with_desc("edit: Move this line up"), + ["v|<"] = map_cmd(""] = map_cmd(">gv"):with_desc("edit: Increase indent"), - -- Builtin: suckless - ["n|Y"] = map_cmd("y$"):with_desc("edit: Yank text to EOL"), - ["n|D"] = map_cmd("d$"):with_desc("edit: Delete text to EOL"), - ["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"), - ["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"), - ["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"), - ["n|"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"), - ["n|"] = map_callback(function() - _flash_esc_or_noh() - end) - :with_noremap() - :with_silent() - :with_desc("edit: Clear search highlight"), - ["n|o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"), -} - -bind.nvim_load_mapping(builtin_map) - -local plug_map = { - -- Plugin: persisted.nvim - ["n|ss"] = map_cu("SessionSave"):with_noremap():with_silent():with_desc("session: Save"), - ["n|sl"] = map_cu("SessionLoad"):with_noremap():with_silent():with_desc("session: Load current"), - ["n|sd"] = map_cu("SessionDelete"):with_noremap():with_silent():with_desc("session: Delete"), + -- Builtins: "Suckless" - named after r/suckless + ["n|Y"] = map_cmd("y$"):with_desc("edit: Yank text to EOL"), + ["n|D"] = map_cmd("d$"):with_desc("edit: Delete text to EOL"), + ["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"), + ["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"), + ["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"), + ["n|"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"), + ["n|"] = map_callback(function() + _flash_esc_or_noh() + end) + :with_noremap() + :with_silent() + :with_desc("edit: Clear search highlight"), + ["n|o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"), + }, + plugins = { + -- Plugin: persisted.nvim + ["n|ss"] = map_cu("SessionSave"):with_noremap():with_silent():with_desc("session: Save"), + ["n|sl"] = map_cu("SessionLoad"):with_noremap():with_silent():with_desc("session: Load current"), + ["n|sd"] = map_cu("SessionDelete"):with_noremap():with_silent():with_desc("session: Delete"), - -- Plugin: comment.nvim - ["n|gcc"] = map_callback(function() - return vim.v.count == 0 and et("(comment_toggle_linewise_current)") - or et("(comment_toggle_linewise_count)") - end) - :with_silent() - :with_noremap() - :with_expr() - :with_desc("edit: Toggle comment for line"), - ["n|gbc"] = map_callback(function() - return vim.v.count == 0 and et("(comment_toggle_blockwise_current)") - or et("(comment_toggle_blockwise_count)") - end) - :with_silent() - :with_noremap() - :with_expr() - :with_desc("edit: Toggle comment for block"), - ["n|gc"] = map_cmd("(comment_toggle_linewise)") - :with_silent() - :with_noremap() - :with_desc("edit: Toggle comment for line with operator"), - ["n|gb"] = map_cmd("(comment_toggle_blockwise)") - :with_silent() - :with_noremap() - :with_desc("edit: Toggle comment for block with operator"), - ["x|gc"] = map_cmd("(comment_toggle_linewise_visual)") - :with_silent() - :with_noremap() - :with_desc("edit: Toggle comment for line with selection"), - ["x|gb"] = map_cmd("(comment_toggle_blockwise_visual)") - :with_silent() - :with_noremap() - :with_desc("edit: Toggle comment for block with selection"), + -- Plugin: comment.nvim + ["n|gcc"] = map_callback(function() + return vim.v.count == 0 and et("(comment_toggle_linewise_current)") + or et("(comment_toggle_linewise_count)") + end) + :with_silent() + :with_noremap() + :with_expr() + :with_desc("edit: Toggle comment for line"), + ["n|gbc"] = map_callback(function() + return vim.v.count == 0 and et("(comment_toggle_blockwise_current)") + or et("(comment_toggle_blockwise_count)") + end) + :with_silent() + :with_noremap() + :with_expr() + :with_desc("edit: Toggle comment for block"), + ["n|gc"] = map_cmd("(comment_toggle_linewise)") + :with_silent() + :with_noremap() + :with_desc("edit: Toggle comment for line with operator"), + ["n|gb"] = map_cmd("(comment_toggle_blockwise)") + :with_silent() + :with_noremap() + :with_desc("edit: Toggle comment for block with operator"), + ["x|gc"] = map_cmd("(comment_toggle_linewise_visual)") + :with_silent() + :with_noremap() + :with_desc("edit: Toggle comment for line with selection"), + ["x|gb"] = map_cmd("(comment_toggle_blockwise_visual)") + :with_silent() + :with_noremap() + :with_desc("edit: Toggle comment for block with selection"), - -- Plugin: diffview.nvim - ["n|gd"] = map_cr("DiffviewOpen"):with_silent():with_noremap():with_desc("git: Show diff"), - ["n|gD"] = map_cr("DiffviewClose"):with_silent():with_noremap():with_desc("git: Close diff"), + -- Plugin: diffview.nvim + ["n|gd"] = map_cr("DiffviewOpen"):with_silent():with_noremap():with_desc("git: Show diff"), + ["n|gD"] = map_cr("DiffviewClose"):with_silent():with_noremap():with_desc("git: Close diff"), - -- Plugin: hop.nvim - ["nv|w"] = map_cmd("HopWordMW"):with_noremap():with_desc("jump: Goto word"), - ["nv|j"] = map_cmd("HopLineMW"):with_noremap():with_desc("jump: Goto line"), - ["nv|k"] = map_cmd("HopLineMW"):with_noremap():with_desc("jump: Goto line"), - ["nv|c"] = map_cmd("HopChar1MW"):with_noremap():with_desc("jump: Goto one char"), - ["nv|C"] = map_cmd("HopChar2MW"):with_noremap():with_desc("jump: Goto two chars"), + -- Plugin: hop.nvim + ["nv|w"] = map_cmd("HopWordMW"):with_noremap():with_desc("jump: Goto word"), + ["nv|j"] = map_cmd("HopLineMW"):with_noremap():with_desc("jump: Goto line"), + ["nv|k"] = map_cmd("HopLineMW"):with_noremap():with_desc("jump: Goto line"), + ["nv|c"] = map_cmd("HopChar1MW"):with_noremap():with_desc("jump: Goto one char"), + ["nv|C"] = map_cmd("HopChar2MW"):with_noremap():with_desc("jump: Goto two chars"), - -- Plugin: nvim-spectre - ["n|Ss"] = map_callback(function() - require("spectre").toggle() - end) - :with_silent() - :with_noremap() - :with_desc("editn: Toggle search & replace panel"), - ["n|Sp"] = map_callback(function() - require("spectre").open_visual({ select_word = true }) - end) - :with_silent() - :with_noremap() - :with_desc("editn: search&replace current word (project)"), - ["v|Sp"] = map_callback(function() - require("spectre").open_visual() - end) - :with_silent() - :with_noremap() - :with_desc("edit: search & replace current word (project)"), - ["n|Sf"] = map_callback(function() - require("spectre").open_file_search({ select_word = true }) - end) - :with_silent() - :with_noremap() - :with_desc("editn: search & replace current word (file)"), + -- Plugin: nvim-spectre + ["n|Ss"] = map_callback(function() + require("spectre").toggle() + end) + :with_silent() + :with_noremap() + :with_desc("editn: Toggle search & replace panel"), + ["n|Sp"] = map_callback(function() + require("spectre").open_visual({ select_word = true }) + end) + :with_silent() + :with_noremap() + :with_desc("editn: search&replace current word (project)"), + ["v|Sp"] = map_callback(function() + require("spectre").open_visual() + end) + :with_silent() + :with_noremap() + :with_desc("edit: search & replace current word (project)"), + ["n|Sf"] = map_callback(function() + require("spectre").open_file_search({ select_word = true }) + end) + :with_silent() + :with_noremap() + :with_desc("editn: search & replace current word (file)"), - -- Plugin: nvim-treehopper - ["o|m"] = map_cu("lua require('tsht').nodes()"):with_silent():with_desc("jump: Operate across syntax tree"), + -- Plugin: nvim-treehopper + ["o|m"] = map_cu("lua require('tsht').nodes()"):with_silent():with_desc("jump: Operate across syntax tree"), - -- Plugin: suda.vim - ["n|"] = map_cu("SudaWrite"):with_silent():with_noremap():with_desc("editn: Save file using sudo"), + -- Plugin: suda.vim + ["n|"] = map_cu("SudaWrite"):with_silent():with_noremap():with_desc("editn: Save file using sudo"), + }, } -bind.nvim_load_mapping(plug_map) +bind.nvim_load_mapping(mappings.builtins) +bind.nvim_load_mapping(mappings.plugins) diff --git a/lua/keymap/ui.lua b/lua/keymap/ui.lua index 545ddc567..81ac66529 100644 --- a/lua/keymap/ui.lua +++ b/lua/keymap/ui.lua @@ -2,68 +2,91 @@ local bind = require("keymap.bind") local map_cr = bind.map_cr local map_cu = bind.map_cu local map_cmd = bind.map_cmd --- local map_callback = bind.map_callback -local builtin_map = { - -- Builtin: buffer - ["n|bn"] = map_cu("enew"):with_noremap():with_silent():with_desc("buffer: New"), +local mappings = { + builtins = { + -- Builtins: Buffer + ["n|bn"] = map_cu("enew"):with_noremap():with_silent():with_desc("buffer: New"), - -- Builtin: terminal - ["t|h"] = map_cmd("wincmd h"):with_silent():with_noremap():with_desc("window: Focus left"), - ["t|l"] = map_cmd("wincmd l"):with_silent():with_noremap():with_desc("window: Focus right"), - ["t|j"] = map_cmd("wincmd j"):with_silent():with_noremap():with_desc("window: Focus down"), - ["t|k"] = map_cmd("wincmd k"):with_silent():with_noremap():with_desc("window: Focus up"), + -- Builtins: Terminal + ["t|h"] = map_cmd("wincmd h"):with_silent():with_noremap():with_desc("window: Focus left"), + ["t|l"] = map_cmd("wincmd l"):with_silent():with_noremap():with_desc("window: Focus right"), + ["t|j"] = map_cmd("wincmd j"):with_silent():with_noremap():with_desc("window: Focus down"), + ["t|k"] = map_cmd("wincmd k"):with_silent():with_noremap():with_desc("window: Focus up"), - -- Builtin: tab - ["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"), - ["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"), - ["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"), - ["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"), -} - -bind.nvim_load_mapping(builtin_map) + -- Builtins: Tabpage + ["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"), + ["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"), + ["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"), + ["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"), + }, + plugins = { + -- Plugin: nvim-bufdel + ["n|"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"), -local plug_map = { - -- Plugin: nvim-bufdel - ["n|"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"), + -- Plugin: bufferline.nvim + ["n|"] = map_cr("BufferLineCycleNext"):with_noremap():with_silent():with_desc("buffer: Switch to next"), + ["n|"] = map_cr("BufferLineCyclePrev"):with_noremap():with_silent():with_desc("buffer: Switch to prev"), + ["n|"] = map_cr("BufferLineMoveNext") + :with_noremap() + :with_silent() + :with_desc("buffer: Move current to next"), + ["n|"] = map_cr("BufferLineMovePrev") + :with_noremap() + :with_silent() + :with_desc("buffer: Move current to prev"), + ["n|be"] = map_cr("BufferLineSortByExtension"):with_noremap():with_desc("buffer: Sort by extension"), + ["n|bd"] = map_cr("BufferLineSortByDirectory"):with_noremap():with_desc("buffer: Sort by directory"), + ["n|"] = map_cr("BufferLineGoToBuffer 1"):with_noremap():with_silent():with_desc("buffer: Goto buffer 1"), + ["n|"] = map_cr("BufferLineGoToBuffer 2"):with_noremap():with_silent():with_desc("buffer: Goto buffer 2"), + ["n|"] = map_cr("BufferLineGoToBuffer 3"):with_noremap():with_silent():with_desc("buffer: Goto buffer 3"), + ["n|"] = map_cr("BufferLineGoToBuffer 4"):with_noremap():with_silent():with_desc("buffer: Goto buffer 4"), + ["n|"] = map_cr("BufferLineGoToBuffer 5"):with_noremap():with_silent():with_desc("buffer: Goto buffer 5"), + ["n|"] = map_cr("BufferLineGoToBuffer 6"):with_noremap():with_silent():with_desc("buffer: Goto buffer 6"), + ["n|"] = map_cr("BufferLineGoToBuffer 7"):with_noremap():with_silent():with_desc("buffer: Goto buffer 7"), + ["n|"] = map_cr("BufferLineGoToBuffer 8"):with_noremap():with_silent():with_desc("buffer: Goto buffer 8"), + ["n|"] = map_cr("BufferLineGoToBuffer 9"):with_noremap():with_silent():with_desc("buffer: Goto buffer 9"), - -- Plugin: bufferline.nvim - ["n|"] = map_cr("BufferLineCycleNext"):with_noremap():with_silent():with_desc("buffer: Switch to next"), - ["n|"] = map_cr("BufferLineCyclePrev"):with_noremap():with_silent():with_desc("buffer: Switch to prev"), - ["n|"] = map_cr("BufferLineMoveNext"):with_noremap():with_silent():with_desc("buffer: Move current to next"), - ["n|"] = map_cr("BufferLineMovePrev"):with_noremap():with_silent():with_desc("buffer: Move current to prev"), - ["n|be"] = map_cr("BufferLineSortByExtension"):with_noremap():with_desc("buffer: Sort by extension"), - ["n|bd"] = map_cr("BufferLineSortByDirectory"):with_noremap():with_desc("buffer: Sort by directory"), - ["n|"] = map_cr("BufferLineGoToBuffer 1"):with_noremap():with_silent():with_desc("buffer: Goto buffer 1"), - ["n|"] = map_cr("BufferLineGoToBuffer 2"):with_noremap():with_silent():with_desc("buffer: Goto buffer 2"), - ["n|"] = map_cr("BufferLineGoToBuffer 3"):with_noremap():with_silent():with_desc("buffer: Goto buffer 3"), - ["n|"] = map_cr("BufferLineGoToBuffer 4"):with_noremap():with_silent():with_desc("buffer: Goto buffer 4"), - ["n|"] = map_cr("BufferLineGoToBuffer 5"):with_noremap():with_silent():with_desc("buffer: Goto buffer 5"), - ["n|"] = map_cr("BufferLineGoToBuffer 6"):with_noremap():with_silent():with_desc("buffer: Goto buffer 6"), - ["n|"] = map_cr("BufferLineGoToBuffer 7"):with_noremap():with_silent():with_desc("buffer: Goto buffer 7"), - ["n|"] = map_cr("BufferLineGoToBuffer 8"):with_noremap():with_silent():with_desc("buffer: Goto buffer 8"), - ["n|"] = map_cr("BufferLineGoToBuffer 9"):with_noremap():with_silent():with_desc("buffer: Goto buffer 9"), - - -- Plugin: smart-splits.nvim - ["n|"] = map_cu("SmartResizeLeft"):with_silent():with_noremap():with_desc("window: Resize -3 horizontally"), - ["n|"] = map_cu("SmartResizeDown"):with_silent():with_noremap():with_desc("window: Resize -3 vertically"), - ["n|"] = map_cu("SmartResizeUp"):with_silent():with_noremap():with_desc("window: Resize +3 vertically"), - ["n|"] = map_cu("SmartResizeRight"):with_silent():with_noremap():with_desc("window: Resize +3 horizontally"), - ["n|"] = map_cu("SmartCursorMoveLeft"):with_silent():with_noremap():with_desc("window: Focus left"), - ["n|"] = map_cu("SmartCursorMoveDown"):with_silent():with_noremap():with_desc("window: Focus down"), - ["n|"] = map_cu("SmartCursorMoveUp"):with_silent():with_noremap():with_desc("window: Focus up"), - ["n|"] = map_cu("SmartCursorMoveRight"):with_silent():with_noremap():with_desc("window: Focus right"), - ["n|Wh"] = map_cu("SmartSwapLeft"):with_silent():with_noremap():with_desc("window: Move window leftward"), - ["n|Wj"] = map_cu("SmartSwapDown"):with_silent():with_noremap():with_desc("window: Move window downward"), - ["n|Wk"] = map_cu("SmartSwapUp"):with_silent():with_noremap():with_desc("window: Move window upward"), - ["n|Wl"] = map_cu("SmartSwapRight"):with_silent():with_noremap():with_desc("window: Move window rightward"), + -- Plugin: smart-splits.nvim + ["n|"] = map_cu("SmartResizeLeft") + :with_silent() + :with_noremap() + :with_desc("window: Resize -3 horizontally"), + ["n|"] = map_cu("SmartResizeDown"):with_silent():with_noremap():with_desc("window: Resize -3 vertically"), + ["n|"] = map_cu("SmartResizeUp"):with_silent():with_noremap():with_desc("window: Resize +3 vertically"), + ["n|"] = map_cu("SmartResizeRight") + :with_silent() + :with_noremap() + :with_desc("window: Resize +3 horizontally"), + ["n|"] = map_cu("SmartCursorMoveLeft"):with_silent():with_noremap():with_desc("window: Focus left"), + ["n|"] = map_cu("SmartCursorMoveDown"):with_silent():with_noremap():with_desc("window: Focus down"), + ["n|"] = map_cu("SmartCursorMoveUp"):with_silent():with_noremap():with_desc("window: Focus up"), + ["n|"] = map_cu("SmartCursorMoveRight"):with_silent():with_noremap():with_desc("window: Focus right"), + ["n|Wh"] = map_cu("SmartSwapLeft") + :with_silent() + :with_noremap() + :with_desc("window: Move window leftward"), + ["n|Wj"] = map_cu("SmartSwapDown") + :with_silent() + :with_noremap() + :with_desc("window: Move window downward"), + ["n|Wk"] = map_cu("SmartSwapUp"):with_silent():with_noremap():with_desc("window: Move window upward"), + ["n|Wl"] = map_cu("SmartSwapRight") + :with_silent() + :with_noremap() + :with_desc("window: Move window rightward"), + }, } -bind.nvim_load_mapping(plug_map) +bind.nvim_load_mapping(mappings.builtins) +bind.nvim_load_mapping(mappings.plugins) + +--- The following code enables this file to be exported --- +--- for use with gitsigns lazy-loaded keymap bindings --- -local mapping = {} +local M = {} -function mapping.gitsigns(buf) +function M.gitsigns(buf) local actions = require("gitsigns.actions") local map = { ["n|]g"] = bind.map_callback(function() @@ -138,4 +161,4 @@ function mapping.gitsigns(buf) bind.nvim_load_mapping(map) end -return mapping +return M From 8cb3f92d8ed3227914cd10ace573fac01b2fc736 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:23:13 +0800 Subject: [PATCH 02/15] fix(keymap): apply follow-up changes to related files (#1396) Follow-up for #1395 to apply the same structure & comment tweaks to other defs too Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- lua/keymap/completion.lua | 20 +- lua/keymap/init.lua | 53 ++++-- lua/keymap/lang.lua | 23 ++- lua/keymap/tool.lua | 390 ++++++++++++++++++++------------------ 4 files changed, 260 insertions(+), 226 deletions(-) diff --git a/lua/keymap/completion.lua b/lua/keymap/completion.lua index d9d4dfdcc..870f7663d 100644 --- a/lua/keymap/completion.lua +++ b/lua/keymap/completion.lua @@ -3,15 +3,21 @@ local map_cr = bind.map_cr local map_cmd = bind.map_cmd local map_callback = bind.map_callback -local plug_map = { - ["n|"] = map_cmd("FormatToggle"):with_noremap():with_desc("formatter: Toggle format on save"), - ["n|"] = map_cmd("Format"):with_noremap():with_desc("formatter: Format buffer manually"), +local mappings = { + fmt = { + ["n|"] = map_cmd("FormatToggle"):with_noremap():with_desc("formatter: Toggle format on save"), + ["n|"] = map_cmd("Format"):with_noremap():with_desc("formatter: Format buffer manually"), + }, } -bind.nvim_load_mapping(plug_map) +bind.nvim_load_mapping(mappings.fmt) -local mapping = {} +--- The following code allows this file to be exported --- +--- for use with LSP lazy-loaded keymap bindings --- -function mapping.lsp(buf) +local M = {} + +---@param buf integer +function M.lsp(buf) local map = { -- LSP-related keymaps, ONLY effective in buffers with LSP(s) attached ["n|li"] = map_cr("LspInfo"):with_silent():with_buffer(buf):with_desc("lsp: Info"), @@ -83,4 +89,4 @@ function mapping.lsp(buf) end end -return mapping +return M diff --git a/lua/keymap/init.lua b/lua/keymap/init.lua index dfef620c9..26120272a 100644 --- a/lua/keymap/init.lua +++ b/lua/keymap/init.lua @@ -1,27 +1,42 @@ require("keymap.helpers") local bind = require("keymap.bind") local map_cr = bind.map_cr --- local map_cu = bind.map_cu --- local map_cmd = bind.map_cmd --- local map_callback = bind.map_callback -local plug_map = { - -- Package manager: lazy.nvim - ["n|ph"] = map_cr("Lazy"):with_silent():with_noremap():with_nowait():with_desc("package: Show"), - ["n|ps"] = map_cr("Lazy sync"):with_silent():with_noremap():with_nowait():with_desc("package: Sync"), - ["n|pu"] = map_cr("Lazy update"):with_silent():with_noremap():with_nowait():with_desc("package: Update"), - ["n|pi"] = map_cr("Lazy install"):with_silent():with_noremap():with_nowait():with_desc("package: Install"), - ["n|pl"] = map_cr("Lazy log"):with_silent():with_noremap():with_nowait():with_desc("package: Log"), - ["n|pc"] = map_cr("Lazy check"):with_silent():with_noremap():with_nowait():with_desc("package: Check"), - ["n|pd"] = map_cr("Lazy debug"):with_silent():with_noremap():with_nowait():with_desc("package: Debug"), - ["n|pp"] = map_cr("Lazy profile"):with_silent():with_noremap():with_nowait():with_desc("package: Profile"), - ["n|pr"] = map_cr("Lazy restore"):with_silent():with_noremap():with_nowait():with_desc("package: Restore"), - ["n|px"] = map_cr("Lazy clean"):with_silent():with_noremap():with_nowait():with_desc("package: Clean"), +local mappings = { + core = { + -- Package manager: lazy.nvim + ["n|ph"] = map_cr("Lazy"):with_silent():with_noremap():with_nowait():with_desc("package: Show"), + ["n|ps"] = map_cr("Lazy sync"):with_silent():with_noremap():with_nowait():with_desc("package: Sync"), + ["n|pu"] = map_cr("Lazy update") + :with_silent() + :with_noremap() + :with_nowait() + :with_desc("package: Update"), + ["n|pi"] = map_cr("Lazy install") + :with_silent() + :with_noremap() + :with_nowait() + :with_desc("package: Install"), + ["n|pl"] = map_cr("Lazy log"):with_silent():with_noremap():with_nowait():with_desc("package: Log"), + ["n|pc"] = map_cr("Lazy check"):with_silent():with_noremap():with_nowait():with_desc("package: Check"), + ["n|pd"] = map_cr("Lazy debug"):with_silent():with_noremap():with_nowait():with_desc("package: Debug"), + ["n|pp"] = map_cr("Lazy profile") + :with_silent() + :with_noremap() + :with_nowait() + :with_desc("package: Profile"), + ["n|pr"] = map_cr("Lazy restore") + :with_silent() + :with_noremap() + :with_nowait() + :with_desc("package: Restore"), + ["n|px"] = map_cr("Lazy clean"):with_silent():with_noremap():with_nowait():with_desc("package: Clean"), + }, } -bind.nvim_load_mapping(plug_map) +bind.nvim_load_mapping(mappings.core) --- Plugin keymaps +-- Builtin & Plugin keymaps require("keymap.completion") require("keymap.editor") require("keymap.lang") @@ -29,7 +44,7 @@ require("keymap.tool") require("keymap.ui") -- User keymaps -local ok, mappings = pcall(require, "user.keymap.init") +local ok, def = pcall(require, "user.keymap.init") if ok then - require("modules.utils.keymap").replace(mappings) + require("modules.utils.keymap").replace(def) end diff --git a/lua/keymap/lang.lua b/lua/keymap/lang.lua index aef337350..fc2fba9ed 100644 --- a/lua/keymap/lang.lua +++ b/lua/keymap/lang.lua @@ -1,17 +1,16 @@ local bind = require("keymap.bind") local map_cr = bind.map_cr --- local map_cu = bind.map_cu --- local map_cmd = bind.map_cmd --- local map_callback = bind.map_callback -local plug_map = { - -- Plugin render-markdown.nvim - ["n|"] = map_cr("RenderMarkdown toggle") - :with_noremap() - :with_silent() - :with_desc("tool: toggle markdown preview within nvim"), - -- Plugin MarkdownPreview - ["n|"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"), +local mappings = { + plugins = { + -- Plugins: render-markdown.nvim + ["n|"] = map_cr("RenderMarkdown toggle") + :with_noremap() + :with_silent() + :with_desc("tool: toggle markdown preview within nvim"), + -- Plugins: MarkdownPreview + ["n|"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"), + }, } -bind.nvim_load_mapping(plug_map) +bind.nvim_load_mapping(mappings.plugins) diff --git a/lua/keymap/tool.lua b/lua/keymap/tool.lua index 471e9b1a4..6be7780a7 100644 --- a/lua/keymap/tool.lua +++ b/lua/keymap/tool.lua @@ -6,200 +6,214 @@ local map_callback = bind.map_callback local vim_path = require("core.global").vim_path require("keymap.helpers") -local plug_map = { - -- Plugin: edgy - ["n|"] = map_callback(function() - require("edgy").toggle("left") - end) - :with_noremap() - :with_silent() - :with_desc("filetree: Toggle"), +local mappings = { + plugins = { + -- Plugin: edgy + ["n|"] = map_callback(function() + require("edgy").toggle("left") + end) + :with_noremap() + :with_silent() + :with_desc("filetree: Toggle"), - -- Plugin: vim-fugitive - ["n|gps"] = map_cr("G push"):with_noremap():with_silent():with_desc("git: Push"), - ["n|gpl"] = map_cr("G pull"):with_noremap():with_silent():with_desc("git: Pull"), - ["n|gG"] = map_cu("Git"):with_noremap():with_silent():with_desc("git: Open git-fugitive"), + -- Plugin: vim-fugitive + ["n|gps"] = map_cr("G push"):with_noremap():with_silent():with_desc("git: Push"), + ["n|gpl"] = map_cr("G pull"):with_noremap():with_silent():with_desc("git: Pull"), + ["n|gG"] = map_cu("Git"):with_noremap():with_silent():with_desc("git: Open git-fugitive"), - -- Plugin: nvim-tree - ["n|nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent():with_desc("filetree: Find file"), - ["n|nr"] = map_cr("NvimTreeRefresh"):with_noremap():with_silent():with_desc("filetree: Refresh"), + -- Plugin: nvim-tree + ["n|nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent():with_desc("filetree: Find file"), + ["n|nr"] = map_cr("NvimTreeRefresh"):with_noremap():with_silent():with_desc("filetree: Refresh"), - -- Plugin: sniprun - ["v|r"] = map_cr("SnipRun"):with_noremap():with_silent():with_desc("tool: Run code by range"), - ["n|r"] = map_cu([[%SnipRun]]):with_noremap():with_silent():with_desc("tool: Run code by file"), + -- Plugin: sniprun + ["v|r"] = map_cr("SnipRun"):with_noremap():with_silent():with_desc("tool: Run code by range"), + ["n|r"] = map_cu([[%SnipRun]]):with_noremap():with_silent():with_desc("tool: Run code by file"), - -- Plugin: toggleterm - ["t|"] = map_cmd([[]]):with_noremap():with_silent(), -- switch to normal mode in terminal. - ["n|"] = map_cr("ToggleTerm direction=horizontal") - :with_noremap() - :with_silent() - :with_desc("terminal: Toggle horizontal"), - ["i|"] = map_cmd("ToggleTerm direction=horizontal") - :with_noremap() - :with_silent() - :with_desc("terminal: Toggle horizontal"), - ["t|"] = map_cmd("ToggleTerm"):with_noremap():with_silent():with_desc("terminal: Toggle horizontal"), - ["n|"] = map_cr("ToggleTerm direction=vertical") - :with_noremap() - :with_silent() - :with_desc("terminal: Toggle vertical"), - ["i|"] = map_cmd("ToggleTerm direction=vertical") - :with_noremap() - :with_silent() - :with_desc("terminal: Toggle vertical"), - ["t|"] = map_cmd("ToggleTerm"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"), - ["n|"] = map_cr("ToggleTerm direction=vertical") - :with_noremap() - :with_silent() - :with_desc("terminal: Toggle vertical"), - ["i|"] = map_cmd("ToggleTerm direction=vertical") - :with_noremap() - :with_silent() - :with_desc("terminal: Toggle vertical"), - ["t|"] = map_cmd("ToggleTerm"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"), - ["n|"] = map_cr("ToggleTerm direction=float"):with_noremap():with_silent():with_desc("terminal: Toggle float"), - ["i|"] = map_cmd("ToggleTerm direction=float") - :with_noremap() - :with_silent() - :with_desc("terminal: Toggle float"), - ["t|"] = map_cmd("ToggleTerm"):with_noremap():with_silent():with_desc("terminal: Toggle float"), - ["n|gg"] = map_callback(function() - _toggle_lazygit() - end) - :with_noremap() - :with_silent() - :with_desc("git: Toggle lazygit"), + -- Plugin: toggleterm + ["t|"] = map_cmd([[]]):with_noremap():with_silent(), -- switch to normal mode in terminal. + ["n|"] = map_cr("ToggleTerm direction=horizontal") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle horizontal"), + ["i|"] = map_cmd("ToggleTerm direction=horizontal") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle horizontal"), + ["t|"] = map_cmd("ToggleTerm") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle horizontal"), + ["n|"] = map_cr("ToggleTerm direction=vertical") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle vertical"), + ["i|"] = map_cmd("ToggleTerm direction=vertical") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle vertical"), + ["t|"] = map_cmd("ToggleTerm") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle vertical"), + ["n|"] = map_cr("ToggleTerm direction=vertical") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle vertical"), + ["i|"] = map_cmd("ToggleTerm direction=vertical") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle vertical"), + ["t|"] = map_cmd("ToggleTerm"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"), + ["n|"] = map_cr("ToggleTerm direction=float") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle float"), + ["i|"] = map_cmd("ToggleTerm direction=float") + :with_noremap() + :with_silent() + :with_desc("terminal: Toggle float"), + ["t|"] = map_cmd("ToggleTerm"):with_noremap():with_silent():with_desc("terminal: Toggle float"), + ["n|gg"] = map_callback(function() + _toggle_lazygit() + end) + :with_noremap() + :with_silent() + :with_desc("git: Toggle lazygit"), - -- Plugin: trouble - ["n|gt"] = map_cr("Trouble diagnostics toggle"):with_noremap():with_silent():with_desc("lsp: Toggle trouble list"), - ["n|lw"] = map_cr("Trouble diagnostics toggle") - :with_noremap() - :with_silent() - :with_desc("lsp: Show workspace diagnostics"), - ["n|lp"] = map_cr("Trouble project_diagnostics toggle") - :with_noremap() - :with_silent() - :with_desc("lsp: Show project diagnostics"), - ["n|ld"] = map_cr("Trouble diagnostics toggle filter.buf=0") - :with_noremap() - :with_silent() - :with_desc("lsp: Show document diagnostics"), + -- Plugin: trouble + ["n|gt"] = map_cr("Trouble diagnostics toggle") + :with_noremap() + :with_silent() + :with_desc("lsp: Toggle trouble list"), + ["n|lw"] = map_cr("Trouble diagnostics toggle") + :with_noremap() + :with_silent() + :with_desc("lsp: Show workspace diagnostics"), + ["n|lp"] = map_cr("Trouble project_diagnostics toggle") + :with_noremap() + :with_silent() + :with_desc("lsp: Show project diagnostics"), + ["n|ld"] = map_cr("Trouble diagnostics toggle filter.buf=0") + :with_noremap() + :with_silent() + :with_desc("lsp: Show document diagnostics"), - -- Plugin: telescope - ["n|"] = map_callback(function() - _command_panel() - end) - :with_noremap() - :with_silent() - :with_desc("tool: Toggle command panel"), - ["n|fc"] = map_callback(function() - _telescope_collections(require("telescope.themes").get_dropdown()) - end) - :with_noremap() - :with_silent() - :with_desc("tool: Open Telescope collections"), - ["n|ff"] = map_callback(function() - require("search").open({ collection = "file" }) - end) - :with_noremap() - :with_silent() - :with_desc("tool: Find files"), - ["n|fp"] = map_callback(function() - require("search").open({ collection = "pattern" }) - end) - :with_noremap() - :with_silent() - :with_desc("tool: Find patterns"), - ["v|fs"] = map_callback(function() - local opts = {} - if vim.fn.getcwd() == vim_path then - opts["additional_args"] = { "--no-ignore" } - end - require("telescope-live-grep-args.shortcuts").grep_visual_selection(opts) - end) - :with_noremap() - :with_silent() - :with_desc("tool: Find word under cursor"), - ["n|fg"] = map_callback(function() - require("search").open({ collection = "git" }) - end) - :with_noremap() - :with_silent() - :with_desc("tool: Locate Git objects"), - ["n|fd"] = map_callback(function() - require("search").open({ collection = "dossier" }) - end) - :with_noremap() - :with_silent() - :with_desc("tool: Retrieve dossiers"), - ["n|fm"] = map_callback(function() - require("search").open({ collection = "misc" }) - end) - :with_noremap() - :with_silent() - :with_desc("tool: Miscellaneous"), + -- Plugin: telescope + ["n|"] = map_callback(function() + _command_panel() + end) + :with_noremap() + :with_silent() + :with_desc("tool: Toggle command panel"), + ["n|fc"] = map_callback(function() + _telescope_collections(require("telescope.themes").get_dropdown()) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Open Telescope collections"), + ["n|ff"] = map_callback(function() + require("search").open({ collection = "file" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Find files"), + ["n|fp"] = map_callback(function() + require("search").open({ collection = "pattern" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Find patterns"), + ["v|fs"] = map_callback(function() + local opts = {} + if vim.fn.getcwd() == vim_path then + opts["additional_args"] = { "--no-ignore" } + end + require("telescope-live-grep-args.shortcuts").grep_visual_selection(opts) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Find word under cursor"), + ["n|fg"] = map_callback(function() + require("search").open({ collection = "git" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Locate Git objects"), + ["n|fd"] = map_callback(function() + require("search").open({ collection = "dossier" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Retrieve dossiers"), + ["n|fm"] = map_callback(function() + require("search").open({ collection = "misc" }) + end) + :with_noremap() + :with_silent() + :with_desc("tool: Miscellaneous"), - -- Plugin: dap - ["n|"] = map_callback(function() - _async_compile_and_debug() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Run/Continue"), - ["n|"] = map_callback(function() - require("dap").terminate() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Stop"), - ["n|"] = map_callback(function() - require("dap").toggle_breakpoint() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Toggle breakpoint"), - ["n|"] = map_callback(function() - require("dap").step_into() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Step into"), - ["n|"] = map_callback(function() - require("dap").step_out() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Step out"), - ["n|"] = map_callback(function() - require("dap").step_over() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Step over"), - ["n|db"] = map_callback(function() - require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) - end) - :with_noremap() - :with_silent() - :with_desc("debug: Set breakpoint with condition"), - ["n|dc"] = map_callback(function() - require("dap").run_to_cursor() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Run to cursor"), - ["n|dl"] = map_callback(function() - require("dap").run_last() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Run last"), - ["n|do"] = map_callback(function() - require("dap").repl.open() - end) - :with_noremap() - :with_silent() - :with_desc("debug: Open REPL"), + -- Plugin: dap + ["n|"] = map_callback(function() + _async_compile_and_debug() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Run/Continue"), + ["n|"] = map_callback(function() + require("dap").terminate() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Stop"), + ["n|"] = map_callback(function() + require("dap").toggle_breakpoint() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Toggle breakpoint"), + ["n|"] = map_callback(function() + require("dap").step_into() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Step into"), + ["n|"] = map_callback(function() + require("dap").step_out() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Step out"), + ["n|"] = map_callback(function() + require("dap").step_over() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Step over"), + ["n|db"] = map_callback(function() + require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) + end) + :with_noremap() + :with_silent() + :with_desc("debug: Set breakpoint with condition"), + ["n|dc"] = map_callback(function() + require("dap").run_to_cursor() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Run to cursor"), + ["n|dl"] = map_callback(function() + require("dap").run_last() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Run last"), + ["n|do"] = map_callback(function() + require("dap").repl.open() + end) + :with_noremap() + :with_silent() + :with_desc("debug: Open REPL"), + }, } -bind.nvim_load_mapping(plug_map) +bind.nvim_load_mapping(mappings.plugins) From 5c3d6e2f814450ddf32300c7cbb677ee740e78f2 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:29:20 +0800 Subject: [PATCH 03/15] fix(utils): add nil check for `g:colors_name` (#1399) This commit is a follow-up fix for #1369, simplifying the change to a single line. Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- lua/modules/utils/init.lua | 69 ++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/lua/modules/utils/init.lua b/lua/modules/utils/init.lua index cedac6634..35a3d74ab 100644 --- a/lua/modules/utils/init.lua +++ b/lua/modules/utils/init.lua @@ -29,7 +29,7 @@ local M = {} ---@field crust string ---@field none "NONE" ----@type nil|table +---@type nil|palette local palette = nil -- Indicates if autocmd for refreshing the builtin palette has already been registered @@ -56,43 +56,38 @@ local function init_palette() }) end - local fallback_palette = { - rosewater = "#DC8A78", - flamingo = "#DD7878", - mauve = "#CBA6F7", - pink = "#F5C2E7", - red = "#E95678", - maroon = "#B33076", - peach = "#FF8700", - yellow = "#F7BB3B", - green = "#AFD700", - sapphire = "#36D0E0", - blue = "#61AFEF", - sky = "#04A5E5", - teal = "#B5E8E0", - lavender = "#7287FD", - - text = "#F2F2BF", - subtext1 = "#BAC2DE", - subtext0 = "#A6ADC8", - overlay2 = "#C3BAC6", - overlay1 = "#988BA2", - overlay0 = "#6E6B6B", - surface2 = "#6E6C7E", - surface1 = "#575268", - surface0 = "#302D41", - - base = "#1D1536", - mantle = "#1C1C19", - crust = "#161320", - } - if not palette then - if vim.g.colors_name == nil or (vim.g.colors_name ~= nil and not vim.g.colors_name:find("catppuccin")) then - palette = fallback_palette - else - palette = require("catppuccin.palettes").get_palette() - end + palette = (vim.g.colors_name or ""):find("catppuccin") and require("catppuccin.palettes").get_palette() + or { + rosewater = "#DC8A78", + flamingo = "#DD7878", + mauve = "#CBA6F7", + pink = "#F5C2E7", + red = "#E95678", + maroon = "#B33076", + peach = "#FF8700", + yellow = "#F7BB3B", + green = "#AFD700", + sapphire = "#36D0E0", + blue = "#61AFEF", + sky = "#04A5E5", + teal = "#B5E8E0", + lavender = "#7287FD", + + text = "#F2F2BF", + subtext1 = "#BAC2DE", + subtext0 = "#A6ADC8", + overlay2 = "#C3BAC6", + overlay1 = "#988BA2", + overlay0 = "#6E6B6B", + surface2 = "#6E6C7E", + surface1 = "#575268", + surface0 = "#302D41", + + base = "#1D1536", + mantle = "#1C1C19", + crust = "#161320", + } palette = vim.tbl_extend("force", { none = "NONE" }, palette, require("core.settings").palette_overwrite) end From de69eef601cb5a93c07ccd9cdbb5024f3f0b7a89 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:31:59 +0800 Subject: [PATCH 04/15] fix(lsp): only merge configs when absolutely needed (#1400) * Revert "fix: merge user customized config with predefined. (#1376)" This reverts commit 42ce15d3a408a45f2fef5aa24334703283245177. * fix(lsp): only merge configs when absolutely needed This commit is a follow-up fix for #1376 to delay merging user & default configs as much as we can to avoid extra overhead Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --------- Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- .../configs/completion/mason-lspconfig.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lua/modules/configs/completion/mason-lspconfig.lua b/lua/modules/configs/completion/mason-lspconfig.lua index 4e8bb74d5..9e2b18803 100644 --- a/lua/modules/configs/completion/mason-lspconfig.lua +++ b/lua/modules/configs/completion/mason-lspconfig.lua @@ -52,26 +52,30 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire end local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name) - local predefined_ok, predefined = pcall(require, "completion.servers." .. lsp_name) + local default_ok, default_handler = pcall(require, "completion.servers." .. lsp_name) -- Use preset if there is no user definition if not ok then - ok, custom_handler = predefined_ok, predefined - else - if type(custom_handler) == "table" and type(predefined) == "table" then - custom_handler = vim.tbl_deep_extend("force", predefined, custom_handler) - end + ok, custom_handler = default_ok, default_handler end if not ok then -- Default to use factory config for server(s) that doesn't include a spec nvim_lsp[lsp_name].setup(opts) + return elseif type(custom_handler) == "function" then --- Case where language server requires its own setup --- Make sure to call require("lspconfig")[lsp_name].setup() in the function --- See `clangd.lua` for example. custom_handler(opts) elseif type(custom_handler) == "table" then - nvim_lsp[lsp_name].setup(vim.tbl_deep_extend("force", opts, custom_handler)) + nvim_lsp[lsp_name].setup( + vim.tbl_deep_extend( + "force", + opts, + type(default_handler) == "table" and default_handler or {}, + custom_handler + ) + ) else vim.notify( string.format( From fa92245d1b7fd119d115c3fbdd7c7062c6edbd01 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:33:35 +0800 Subject: [PATCH 05/15] chore(user_template): create an empty `snips` dir by default (#1402) Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- lua/user_template/snips/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lua/user_template/snips/.gitkeep diff --git a/lua/user_template/snips/.gitkeep b/lua/user_template/snips/.gitkeep new file mode 100644 index 000000000..e69de29bb From c198eb888808131b36de45791192172aba27b8c0 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:33:53 +0800 Subject: [PATCH 06/15] chore(keymap.fmt): replace manual map_cmd with map_cr (#1401) Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> Signed-off-by: ayamir Co-authored-by: ayamir --- lua/keymap/completion.lua | 5 ++--- lua/modules/configs/completion/formatting.lua | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/keymap/completion.lua b/lua/keymap/completion.lua index 870f7663d..634a6e961 100644 --- a/lua/keymap/completion.lua +++ b/lua/keymap/completion.lua @@ -1,12 +1,11 @@ local bind = require("keymap.bind") local map_cr = bind.map_cr -local map_cmd = bind.map_cmd local map_callback = bind.map_callback local mappings = { fmt = { - ["n|"] = map_cmd("FormatToggle"):with_noremap():with_desc("formatter: Toggle format on save"), - ["n|"] = map_cmd("Format"):with_noremap():with_desc("formatter: Format buffer manually"), + ["n|"] = map_cr("FormatToggle"):with_noremap():with_silent():with_desc("formatter: Toggle format on save"), + ["n|"] = map_cr("Format"):with_noremap():with_silent():with_desc("formatter: Format buffer manually"), }, } bind.nvim_load_mapping(mappings.fmt) diff --git a/lua/modules/configs/completion/formatting.lua b/lua/modules/configs/completion/formatting.lua index 6b804343d..a64cfe686 100644 --- a/lua/modules/configs/completion/formatting.lua +++ b/lua/modules/configs/completion/formatting.lua @@ -8,10 +8,6 @@ local format_modifications_only = settings.format_modifications_only local server_formatting_block_list = settings.server_formatting_block_list local format_timeout = settings.format_timeout -vim.api.nvim_create_user_command("FormatToggle", function() - M.toggle_format_on_save() -end, {}) - vim.api.nvim_create_user_command("Format", function() M.format({ timeout = format_timeout, @@ -19,6 +15,10 @@ vim.api.nvim_create_user_command("Format", function() }) end, {}) +vim.api.nvim_create_user_command("FormatToggle", function() + M.toggle_format_on_save() +end, {}) + local block_list = settings.formatter_block_list vim.api.nvim_create_user_command("FormatterToggleFt", function(opts) if block_list[opts.args] == nil then From a09dff09fb4bdb4ffb1019bad20a197e626f3cf5 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sun, 19 Jan 2025 23:37:37 +0800 Subject: [PATCH 07/15] chore(keymap.live-grep): simplify (#1403) * chore(keymap.live-grep): simplify Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> * style: add comment for telescope. Signed-off-by: ayamir --------- Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> Signed-off-by: ayamir Co-authored-by: ayamir --- lua/keymap/tool.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/keymap/tool.lua b/lua/keymap/tool.lua index 6be7780a7..44ccf2935 100644 --- a/lua/keymap/tool.lua +++ b/lua/keymap/tool.lua @@ -1,9 +1,9 @@ +local vim_path = require("core.global").vim_path local bind = require("keymap.bind") local map_cr = bind.map_cr local map_cu = bind.map_cu local map_cmd = bind.map_cmd local map_callback = bind.map_callback -local vim_path = require("core.global").vim_path require("keymap.helpers") local mappings = { @@ -124,10 +124,7 @@ local mappings = { :with_silent() :with_desc("tool: Find patterns"), ["v|fs"] = map_callback(function() - local opts = {} - if vim.fn.getcwd() == vim_path then - opts["additional_args"] = { "--no-ignore" } - end + local opts = vim.fn.getcwd() == vim_path and { additional_args = { "--no-ignore" } } or {} require("telescope-live-grep-args.shortcuts").grep_visual_selection(opts) end) :with_noremap() From 360d4deb0fa89bafe8ded15f44fb1fc3e1555e9c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 02:01:30 +0000 Subject: [PATCH 08/15] chore(lockfile): auto update lazy-lock.json --- lazy-lock.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 02530b47a..d4277f2e1 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -22,12 +22,12 @@ "crates.nvim": { "branch": "main", "commit": "bd35b13e94a292ee6e32c351e05ca2202dc9f070" }, "csv.vim": { "branch": "master", "commit": "44aeb7e26e8b42f7c14c328f16ac4744ae53b22c" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dropbar.nvim": { "branch": "master", "commit": "d2792fc7c163722b7d3607c9ad3aeb7192e009e4" }, + "dropbar.nvim": { "branch": "master", "commit": "8267757a5d584abe939d005368fe1524be1b25d3" }, "edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" }, "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf": { "branch": "master", "commit": "0a10d14e190eac2d3aa3d88f3b45e84d3f4431be" }, + "fzf": { "branch": "master", "commit": "65db7352b72845b306e6bc1388a4ad02d0f57a70" }, "fzy-lua-native": { "branch": "master", "commit": "9d720745d5c2fb563c0d86c17d77612a3519c506" }, "gitsigns.nvim": { "branch": "main", "commit": "817bd848fffe82e697b4da656e3f2834cd0665c5" }, "glance.nvim": { "branch": "master", "commit": "1a08824835d7582457b67acbe23ca33487912a5e" }, @@ -39,7 +39,7 @@ "local-highlight.nvim": { "branch": "master", "commit": "c8e5fa9a945b7e99bccba2c9993b4d7a0327173d" }, "lsp-format-modifications.nvim": { "branch": "main", "commit": "006d4cd88f4f09fdc4375fcb75dd5b7d981a723b" }, "lsp_signature.nvim": { "branch": "master", "commit": "a47bc81c457f13db9ebdb5fac5dff651d71a501d" }, - "lspsaga.nvim": { "branch": "main", "commit": "8084e8447bef3f94863949087707e6221a4e5df7" }, + "lspsaga.nvim": { "branch": "main", "commit": "13b3cdc9a53ec821b9e693ee71501cc2d6cf206c" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, @@ -56,14 +56,14 @@ "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, "nvim-highlight-colors": { "branch": "main", "commit": "68a4df620cf58e2c7336e53738e8cf3a522ad694" }, - "nvim-lspconfig": { "branch": "master", "commit": "14b5a806c928390fac9ff4a5630d20eb902afad8" }, + "nvim-lspconfig": { "branch": "master", "commit": "9ee2e7dac2e1c74538a0e0d79b9e2d59a8517bd6" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, "nvim-scrollview": { "branch": "main", "commit": "9cb1ab7f6cb821612e9a7f41652c200be0e75123" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, "nvim-tree.lua": { "branch": "master", "commit": "fca0b67c0b5a31727fb33addc4d9c100736a2894" }, "nvim-treehopper": { "branch": "master", "commit": "e87002968983ed23836dfad53bcf023e609db42d" }, - "nvim-treesitter": { "branch": "master", "commit": "5da195ac3dfafd08d8b10756d975f0e01e1d563a" }, + "nvim-treesitter": { "branch": "master", "commit": "87b1f250980d288f37bfacae8bcafc0d843c2751" }, "nvim-treesitter-context": { "branch": "master", "commit": "bece284c5322ddf6946fa4bdc383a2bc033269d7" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, From 9b7086754996fe9691fefa36ad7a36b1512cc2d0 Mon Sep 17 00:00:00 2001 From: AngelontheRoad <52699138+AngelontheRoad@users.noreply.github.com> Date: Thu, 23 Jan 2025 20:37:09 +0800 Subject: [PATCH 09/15] fix(keymaps): update `toggle display` and `gitsigns` keymaps (#1405) * fix(gitsigns): update keymaps * fix(keymap): move keymaps to --- lua/keymap/completion.lua | 12 ------------ lua/keymap/editor.lua | 14 ++++++++++++++ lua/keymap/ui.lua | 9 +-------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/lua/keymap/completion.lua b/lua/keymap/completion.lua index 634a6e961..0d19f4e86 100644 --- a/lua/keymap/completion.lua +++ b/lua/keymap/completion.lua @@ -67,18 +67,6 @@ function M.lsp(buf) :with_silent() :with_buffer(buf) :with_desc("lsp: Show outgoing calls"), - ["n|td"] = map_callback(function() - _toggle_diagnostic() - end) - :with_noremap() - :with_silent() - :with_desc("edit: Toggle virtual text display of current buffer"), - ["n|th"] = map_callback(function() - _toggle_inlayhint() - end) - :with_noremap() - :with_silent() - :with_desc("edit: Toggle inlay hints dispaly of current buffer"), } bind.nvim_load_mapping(map) diff --git a/lua/keymap/editor.lua b/lua/keymap/editor.lua index 8c8c8cd30..b1bd50146 100644 --- a/lua/keymap/editor.lua +++ b/lua/keymap/editor.lua @@ -50,6 +50,20 @@ local mappings = { :with_silent() :with_desc("edit: Clear search highlight"), ["n|o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"), + + -- Builtins: Lsp + ["n|td"] = map_callback(function() + _toggle_diagnostic() + end) + :with_noremap() + :with_silent() + :with_desc("edit: Toggle global display of virtual text"), + ["n|th"] = map_callback(function() + _toggle_inlayhint() + end) + :with_noremap() + :with_silent() + :with_desc("edit: Toggle global display of inlay hints"), }, plugins = { -- Plugin: persisted.nvim diff --git a/lua/keymap/ui.lua b/lua/keymap/ui.lua index 81ac66529..7b3c8f2bc 100644 --- a/lua/keymap/ui.lua +++ b/lua/keymap/ui.lua @@ -123,11 +123,6 @@ function M.gitsigns(buf) end) :with_buffer(buf) :with_desc("git: Stage hunk"), - ["n|gu"] = bind.map_callback(function() - actions.undo_stage_hunk() - end) - :with_buffer(buf) - :with_desc("git: Undo stage hunk"), ["n|gr"] = bind.map_callback(function() actions.reset_hunk() end) @@ -154,9 +149,7 @@ function M.gitsigns(buf) :with_buffer(buf) :with_desc("git: Blame line"), -- Text objects - ["ox|ih"] = bind.map_callback(function() - actions.text_object() - end):with_buffer(buf), + ["ox|ih"] = bind.map_cu("Gitsigns select_hunk"):with_silent():with_buffer(buf), } bind.nvim_load_mapping(map) end From 048100edb4d99eb709f537328cad2b9a16b3a6b9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 02:00:29 +0000 Subject: [PATCH 10/15] chore(lockfile): auto update lazy-lock.json --- lazy-lock.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index d4277f2e1..56dcfcb75 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -22,19 +22,19 @@ "crates.nvim": { "branch": "main", "commit": "bd35b13e94a292ee6e32c351e05ca2202dc9f070" }, "csv.vim": { "branch": "master", "commit": "44aeb7e26e8b42f7c14c328f16ac4744ae53b22c" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dropbar.nvim": { "branch": "master", "commit": "8267757a5d584abe939d005368fe1524be1b25d3" }, + "dropbar.nvim": { "branch": "master", "commit": "f7137785ed3ddce31d1e2837dc13792d24d217a8" }, "edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" }, "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf": { "branch": "master", "commit": "65db7352b72845b306e6bc1388a4ad02d0f57a70" }, + "fzf": { "branch": "master", "commit": "243a76002c93b474cf8401b37670a43803a0a2d2" }, "fzy-lua-native": { "branch": "master", "commit": "9d720745d5c2fb563c0d86c17d77612a3519c506" }, - "gitsigns.nvim": { "branch": "main", "commit": "817bd848fffe82e697b4da656e3f2834cd0665c5" }, + "gitsigns.nvim": { "branch": "main", "commit": "3ec5fbd9202ae3908551c98c4b6c3c05ff7c8e96" }, "glance.nvim": { "branch": "master", "commit": "1a08824835d7582457b67acbe23ca33487912a5e" }, "go.nvim": { "branch": "master", "commit": "6e5a74b866aa4a112ed85a1169befff2ef82c027" }, "guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" }, "hop.nvim": { "branch": "master", "commit": "08ddca799089ab96a6d1763db0b8adc5320bf050" }, - "indent-blankline.nvim": { "branch": "master", "commit": "7a698a1d7ed755af9f5a88733b23ca246ce2df28" }, + "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, "local-highlight.nvim": { "branch": "master", "commit": "c8e5fa9a945b7e99bccba2c9993b4d7a0327173d" }, "lsp-format-modifications.nvim": { "branch": "main", "commit": "006d4cd88f4f09fdc4375fcb75dd5b7d981a723b" }, @@ -47,23 +47,23 @@ "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.align": { "branch": "main", "commit": "e715137aece7d05734403d793b8b6b64486bc812" }, - "neoconf.nvim": { "branch": "main", "commit": "638216aa8725b06d27c315574de63ad41966a3cd" }, + "neoconf.nvim": { "branch": "main", "commit": "08506584b6d2de32263da2cdb30b9b1a0621f172" }, "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, - "none-ls.nvim": { "branch": "main", "commit": "af318216b744f2fe2d5afa6febb01f455ae61d6c" }, + "none-ls.nvim": { "branch": "main", "commit": "ed8f80849ef1ad31c2f74679fafdef7801091247" }, "nvim-bqf": { "branch": "main", "commit": "ebb6d2689e4427452180f17c53f29f7e460236f1" }, "nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" }, - "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, - "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, "nvim-highlight-colors": { "branch": "main", "commit": "68a4df620cf58e2c7336e53738e8cf3a522ad694" }, - "nvim-lspconfig": { "branch": "master", "commit": "9ee2e7dac2e1c74538a0e0d79b9e2d59a8517bd6" }, - "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, - "nvim-scrollview": { "branch": "main", "commit": "9cb1ab7f6cb821612e9a7f41652c200be0e75123" }, + "nvim-lspconfig": { "branch": "master", "commit": "b4d65bce97795438ab6e1974b3672c17a4865e3c" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, + "nvim-scrollview": { "branch": "main", "commit": "e8ad0e0f9c38c1bf3b03e3266cb6ecf3967d6e47" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, - "nvim-tree.lua": { "branch": "master", "commit": "fca0b67c0b5a31727fb33addc4d9c100736a2894" }, + "nvim-tree.lua": { "branch": "master", "commit": "db7403243d5852e76cb6a5c4fcd5415d1d54ae24" }, "nvim-treehopper": { "branch": "master", "commit": "e87002968983ed23836dfad53bcf023e609db42d" }, - "nvim-treesitter": { "branch": "master", "commit": "87b1f250980d288f37bfacae8bcafc0d843c2751" }, + "nvim-treesitter": { "branch": "master", "commit": "6587a5886873cce8698a47477224c30578b33a24" }, "nvim-treesitter-context": { "branch": "master", "commit": "bece284c5322ddf6946fa4bdc383a2bc033269d7" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, @@ -75,9 +75,9 @@ "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "85b80abaa09cbbc039e3095b2f515b3cf8cadd11" }, "render-markdown.nvim": { "branch": "main", "commit": "ad055861d17afe058bd835e82292e14a64b51b1d" }, - "rustaceanvim": { "branch": "master", "commit": "0a1876b970ab946be3f4d341e9d743a5d62d646a" }, + "rustaceanvim": { "branch": "master", "commit": "e15c262f81e8adb139ef3e3de775493d377919a2" }, "search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" }, - "smart-splits.nvim": { "branch": "master", "commit": "7266722346df921535ca3f317164a62069436b7c" }, + "smart-splits.nvim": { "branch": "master", "commit": "4a231987665d3c6e02ca88833d050e918afe3e1e" }, "smartyank.nvim": { "branch": "master", "commit": "0a4554a4ea4cad73dab0a15e559f2128ca03c7b2" }, "sniprun": { "branch": "master", "commit": "67ac2d84d03f3b857d59571ff5fefb6080dffa2d" }, "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, @@ -91,10 +91,10 @@ "toggleterm.nvim": { "branch": "main", "commit": "e76134e682c1a866e3dfcdaeb691eb7b01068668" }, "trouble.nvim": { "branch": "main", "commit": "50481f414bd3c1a40122c1d759d7e424d5fafe84" }, "vim-cool": { "branch": "master", "commit": "662e7b11064cbeedad17c45d2fe926e78d3cd0b6" }, - "vim-fugitive": { "branch": "master", "commit": "174230d6a7f2df94705a7ffd8d5413e27ec10a80" }, + "vim-fugitive": { "branch": "master", "commit": "d74a7cff4cfcf84f83cc7eccfa365488f3bbabc2" }, "vim-matchup": { "branch": "master", "commit": "aca23ce53ebfe34e02c4fe07e29e9133a2026481" }, "vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, - "which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" }, + "which-key.nvim": { "branch": "main", "commit": "6cebd86917df559a88de0f806b2989799c6e6423" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } } From 9a2721c2abd38d30ad2de9a836f982a6142c1a10 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Sat, 25 Jan 2025 16:28:33 +0800 Subject: [PATCH 11/15] fix(lsp.servers): broken documentation links (#1408) Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- lua/modules/configs/completion/servers/bashls.lua | 2 +- lua/modules/configs/completion/servers/clangd.lua | 2 +- lua/modules/configs/completion/servers/dartls.lua | 2 +- lua/modules/configs/completion/servers/gopls.lua | 2 +- lua/modules/configs/completion/servers/jsonls.lua | 2 +- lua/modules/configs/completion/servers/lua_ls.lua | 2 +- lua/modules/configs/completion/servers/pylsp.lua | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/modules/configs/completion/servers/bashls.lua b/lua/modules/configs/completion/servers/bashls.lua index d5e470f93..cc12751a9 100644 --- a/lua/modules/configs/completion/servers/bashls.lua +++ b/lua/modules/configs/completion/servers/bashls.lua @@ -1,4 +1,4 @@ --- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/bashls.lua +-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/bashls.lua return { cmd = { "bash-language-server", "start" }, filetypes = { "bash", "sh" }, diff --git a/lua/modules/configs/completion/servers/clangd.lua b/lua/modules/configs/completion/servers/clangd.lua index 7661177af..a1ccb825a 100644 --- a/lua/modules/configs/completion/servers/clangd.lua +++ b/lua/modules/configs/completion/servers/clangd.lua @@ -33,7 +33,7 @@ local function get_binary_path_list(binaries) return table.concat(path_list, ",") end --- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua +-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/clangd.lua return function(options) require("lspconfig").clangd.setup({ on_attach = options.on_attach, diff --git a/lua/modules/configs/completion/servers/dartls.lua b/lua/modules/configs/completion/servers/dartls.lua index 5240aef99..bbfdac93a 100644 --- a/lua/modules/configs/completion/servers/dartls.lua +++ b/lua/modules/configs/completion/servers/dartls.lua @@ -1,4 +1,4 @@ --- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/dartls.lua +-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/dartls.lua return { cmd = { "dart", "language-server", "--protocol=lsp" }, filetypes = { "dart" }, diff --git a/lua/modules/configs/completion/servers/gopls.lua b/lua/modules/configs/completion/servers/gopls.lua index c05d1628f..91d408621 100644 --- a/lua/modules/configs/completion/servers/gopls.lua +++ b/lua/modules/configs/completion/servers/gopls.lua @@ -1,4 +1,4 @@ --- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/gopls.lua +-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/gopls.lua return { cmd = { "gopls", "-remote.debug=:0", "-remote=auto" }, filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" }, diff --git a/lua/modules/configs/completion/servers/jsonls.lua b/lua/modules/configs/completion/servers/jsonls.lua index d83198d3f..7e8295d38 100644 --- a/lua/modules/configs/completion/servers/jsonls.lua +++ b/lua/modules/configs/completion/servers/jsonls.lua @@ -1,4 +1,4 @@ --- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jsonls.lua +-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/jsonls.lua return { flags = { debounce_text_changes = 500 }, settings = { diff --git a/lua/modules/configs/completion/servers/lua_ls.lua b/lua/modules/configs/completion/servers/lua_ls.lua index cd68c9ee4..7571a08a2 100644 --- a/lua/modules/configs/completion/servers/lua_ls.lua +++ b/lua/modules/configs/completion/servers/lua_ls.lua @@ -1,4 +1,4 @@ --- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/lua_ls.lua +-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/lua_ls.lua return { settings = { Lua = { diff --git a/lua/modules/configs/completion/servers/pylsp.lua b/lua/modules/configs/completion/servers/pylsp.lua index eb83ccd14..0c98c37cb 100644 --- a/lua/modules/configs/completion/servers/pylsp.lua +++ b/lua/modules/configs/completion/servers/pylsp.lua @@ -1,4 +1,4 @@ --- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/pylsp.lua +-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/pylsp.lua return { cmd = { "pylsp" }, filetypes = { "python" }, From 01790e5d54a8d385b3b4fa22ba45c5e0da32be18 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 26 Jan 2025 02:01:40 +0000 Subject: [PATCH 12/15] chore(lockfile): auto update lazy-lock.json --- lazy-lock.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 56dcfcb75..7128abfa6 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,7 +6,7 @@ "autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" }, "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, - "catppuccin": { "branch": "refactor/syntax-highlighting", "commit": "00e66a94c95dcdc9ef0a71116b32787da3d55c45" }, + "catppuccin": { "branch": "refactor/syntax-highlighting", "commit": "bab72059e88c9c00f8d3bba007e26cfee6a0d634" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-latex-symbols": { "branch": "main", "commit": "86b68e6d6c550442d4a3f826e1b8358c5300824c" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, @@ -22,14 +22,14 @@ "crates.nvim": { "branch": "main", "commit": "bd35b13e94a292ee6e32c351e05ca2202dc9f070" }, "csv.vim": { "branch": "master", "commit": "44aeb7e26e8b42f7c14c328f16ac4744ae53b22c" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dropbar.nvim": { "branch": "master", "commit": "f7137785ed3ddce31d1e2837dc13792d24d217a8" }, + "dropbar.nvim": { "branch": "master", "commit": "eea7f4af890895fe3acb7f6435483c4324999673" }, "edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" }, "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf": { "branch": "master", "commit": "243a76002c93b474cf8401b37670a43803a0a2d2" }, + "fzf": { "branch": "master", "commit": "c13228f34623b856bd22a963959f4655cbfac947" }, "fzy-lua-native": { "branch": "master", "commit": "9d720745d5c2fb563c0d86c17d77612a3519c506" }, - "gitsigns.nvim": { "branch": "main", "commit": "3ec5fbd9202ae3908551c98c4b6c3c05ff7c8e96" }, + "gitsigns.nvim": { "branch": "main", "commit": "d8918f06624dd53b9a82bd0e29c31bcfd541b40d" }, "glance.nvim": { "branch": "master", "commit": "1a08824835d7582457b67acbe23ca33487912a5e" }, "go.nvim": { "branch": "master", "commit": "6e5a74b866aa4a112ed85a1169befff2ef82c027" }, "guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" }, @@ -38,7 +38,7 @@ "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, "local-highlight.nvim": { "branch": "master", "commit": "c8e5fa9a945b7e99bccba2c9993b4d7a0327173d" }, "lsp-format-modifications.nvim": { "branch": "main", "commit": "006d4cd88f4f09fdc4375fcb75dd5b7d981a723b" }, - "lsp_signature.nvim": { "branch": "master", "commit": "a47bc81c457f13db9ebdb5fac5dff651d71a501d" }, + "lsp_signature.nvim": { "branch": "master", "commit": "fd79ea4c26f2a65784b115fc9577a52e0bb8b1bd" }, "lspsaga.nvim": { "branch": "main", "commit": "13b3cdc9a53ec821b9e693ee71501cc2d6cf206c" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, @@ -47,13 +47,13 @@ "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.align": { "branch": "main", "commit": "e715137aece7d05734403d793b8b6b64486bc812" }, - "neoconf.nvim": { "branch": "main", "commit": "08506584b6d2de32263da2cdb30b9b1a0621f172" }, + "neoconf.nvim": { "branch": "main", "commit": "a4d1d337e23a087847f7a1d2bc4420ce7ad355f4" }, "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, "none-ls.nvim": { "branch": "main", "commit": "ed8f80849ef1ad31c2f74679fafdef7801091247" }, "nvim-bqf": { "branch": "main", "commit": "ebb6d2689e4427452180f17c53f29f7e460236f1" }, "nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, + "nvim-dap": { "branch": "master", "commit": "1c96e487dd4180edc5a3c075ea1f03b6b751ef4f" }, "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, "nvim-highlight-colors": { "branch": "main", "commit": "68a4df620cf58e2c7336e53738e8cf3a522ad694" }, "nvim-lspconfig": { "branch": "master", "commit": "b4d65bce97795438ab6e1974b3672c17a4865e3c" }, @@ -61,14 +61,14 @@ "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-scrollview": { "branch": "main", "commit": "e8ad0e0f9c38c1bf3b03e3266cb6ecf3967d6e47" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, - "nvim-tree.lua": { "branch": "master", "commit": "db7403243d5852e76cb6a5c4fcd5415d1d54ae24" }, + "nvim-tree.lua": { "branch": "master", "commit": "fee1da88972f5972a8296813f6c00d7598325ebd" }, "nvim-treehopper": { "branch": "master", "commit": "e87002968983ed23836dfad53bcf023e609db42d" }, - "nvim-treesitter": { "branch": "master", "commit": "6587a5886873cce8698a47477224c30578b33a24" }, + "nvim-treesitter": { "branch": "master", "commit": "f3d7c0dafcbc86c4d63f765649c884a03bc1360a" }, "nvim-treesitter-context": { "branch": "master", "commit": "bece284c5322ddf6946fa4bdc383a2bc033269d7" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, + "nvim-web-devicons": { "branch": "master", "commit": "37334adf4517fecfd97c0b44e1d4718e377e9e52" }, "paint.nvim": { "branch": "main", "commit": "ef6f717a8669619ebbd098fb72f85115d64c6c92" }, "persisted.nvim": { "branch": "main", "commit": "8a25e7028d44645616a503b07b84be62da2fee86" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, @@ -81,7 +81,7 @@ "smartyank.nvim": { "branch": "master", "commit": "0a4554a4ea4cad73dab0a15e559f2128ca03c7b2" }, "sniprun": { "branch": "master", "commit": "67ac2d84d03f3b857d59571ff5fefb6080dffa2d" }, "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, - "telescope-frecency.nvim": { "branch": "master", "commit": "6e581bb7bea187fc03a4be3b252a8adecabc398a" }, + "telescope-frecency.nvim": { "branch": "master", "commit": "cf19bb00e8cd68c54e7cd156efcdc7d978bd4b89" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope-live-grep-args.nvim": { "branch": "master", "commit": "649b662a8f476fd2c0289570764459e95ebaa3f3" }, "telescope-undo.nvim": { "branch": "main", "commit": "2971cc9f193ec09e0c5de3563f99cbea16b63f10" }, From e37d4fbb39adfc35e5943502d25c2a1e9e869826 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Mon, 27 Jan 2025 00:19:37 +0800 Subject: [PATCH 13/15] chore(edgy): cleanup (#1407) This commit basically does some cleanup to #1393: 1. Replaced fixed width/height values w relative dimensions. 2. Removed unnecessary keymaps that were not linked to any other config components, allowing users more flexibility to customize their key mappings. Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- lua/modules/configs/ui/edgy.lua | 35 ++++++++------------------------- lua/modules/plugins/ui.lua | 9 +++++---- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/lua/modules/configs/ui/edgy.lua b/lua/modules/configs/ui/edgy.lua index d1823028e..568d6ff6e 100644 --- a/lua/modules/configs/ui/edgy.lua +++ b/lua/modules/configs/ui/edgy.lua @@ -10,27 +10,13 @@ return function() end require("modules.utils").load_plugin("edgy", { - animate = { - enabled = true, - }, - wo = { - winbar = false, - }, - exit_when_last = true, close_when_all_hidden = true, + exit_when_last = true, + wo = { winbar = false }, keys = { ["q"] = false, ["Q"] = false, - [""] = false, - ["za"] = function(win) - win:toggle() - end, - [""] = function(win) - win:next({ focus = true }) - end, - [""] = function(win) - win:prev({ focus = true }) - end, + [""] = false, [""] = function(win) win:resize("height", -2) end, @@ -50,12 +36,12 @@ return function() ft = "toggleterm", size = { height = 0.3 }, filter = function(_, win) - return vim.api.nvim_win_get_config(win).relative == "" + return vim.w[win].relative == "" end, }, { ft = "help", - size = { height = 20 }, + size = { height = 0.3 }, filter = function(buf) return vim.bo[buf].buftype == "help" end, @@ -65,20 +51,15 @@ return function() { ft = "NvimTree", pinned = true, - collapsed = false, open = "NvimTreeOpen", - size = { - height = 0.5, - width = 40, - }, + size = { width = 30 }, }, }, right = { { ft = "trouble", pinned = true, - collapsed = false, - size = { height = 0.6, width = 0.2 }, + size = { height = 0.6, width = 0.3 }, open = "Trouble symbols toggle win.position=right", filter = trouble_filter("right"), }, @@ -86,7 +67,7 @@ return function() ft = "trouble", pinned = true, collapsed = true, - size = { height = 0.4, width = 0.2 }, + size = { height = 0.4, width = 0.3 }, open = "Trouble lsp toggle win.position=right", filter = trouble_filter("right"), }, diff --git a/lua/modules/plugins/ui.lua b/lua/modules/plugins/ui.lua index 2fa399368..6cc6adb68 100644 --- a/lua/modules/plugins/ui.lua +++ b/lua/modules/plugins/ui.lua @@ -10,6 +10,11 @@ ui["akinsho/bufferline.nvim"] = { event = { "BufReadPre", "BufAdd", "BufNewFile" }, config = require("ui.bufferline"), } +ui["folke/edgy.nvim"] = { + lazy = true, + event = { "BufReadPre", "BufAdd", "BufNewFile" }, + config = require("ui.edgy"), +} ui["Jint-lzxy/nvim"] = { lazy = false, branch = "refactor/syntax-highlighting", @@ -67,9 +72,5 @@ ui["dstein64/nvim-scrollview"] = { event = { "BufReadPost", "BufAdd", "BufNewFile" }, config = require("ui.scrollview"), } -ui["folke/edgy.nvim"] = { - event = "VeryLazy", - config = require("ui.edgy"), -} return ui From dc252eff7f23d1e2f06fa78914711f480337db23 Mon Sep 17 00:00:00 2001 From: jint_lzxy_ <50296129+Jint-lzxy@users.noreply.github.com> Date: Mon, 27 Jan 2025 00:22:44 +0800 Subject: [PATCH 14/15] fix(gitsigns.keymap): update functions and descriptions (#1406) This commit is a follow-up fix for #1405: - `stage_hunk` now toggles between staging and unstaging a hunk (keymap description updated). - Changed the callback for `text_object` to `select_hunk`: ``` > git log --grep text_object commit e22e37897ac328d3f7e00e354852b6c9ffdd1e5d Author: Lewis Russell Date: Thu Mar 25 14:47:33 2021 +0000 Rename text_object() -> select_hunk() ``` Signed-off-by: Jint-lzxy <50296129+Jint-lzxy@users.noreply.github.com> --- lua/keymap/ui.lua | 114 ++++++++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 50 deletions(-) diff --git a/lua/keymap/ui.lua b/lua/keymap/ui.lua index 7b3c8f2bc..68af9737a 100644 --- a/lua/keymap/ui.lua +++ b/lua/keymap/ui.lua @@ -2,6 +2,7 @@ local bind = require("keymap.bind") local map_cr = bind.map_cr local map_cu = bind.map_cu local map_cmd = bind.map_cmd +local map_callback = bind.map_callback local mappings = { builtins = { @@ -86,70 +87,83 @@ bind.nvim_load_mapping(mappings.plugins) local M = {} -function M.gitsigns(buf) +function M.gitsigns(bufnr) local actions = require("gitsigns.actions") local map = { - ["n|]g"] = bind.map_callback(function() - if vim.wo.diff then - return "]g" - end - vim.schedule(function() - actions.next_hunk() + ["n|]g"] = map_callback(function() + if vim.wo.diff then + return "]g" + end + vim.schedule(function() + actions.next_hunk() + end) + return "" end) - return "" - end) - :with_buffer(buf) + :with_buffer(bufnr) + :with_noremap() :with_expr() :with_desc("git: Goto next hunk"), - ["n|[g"] = bind.map_callback(function() - if vim.wo.diff then - return "[g" - end - vim.schedule(function() - actions.prev_hunk() + ["n|[g"] = map_callback(function() + if vim.wo.diff then + return "[g" + end + vim.schedule(function() + actions.prev_hunk() + end) + return "" end) - return "" - end) - :with_buffer(buf) + :with_buffer(bufnr) + :with_noremap() :with_expr() :with_desc("git: Goto prev hunk"), - ["n|gs"] = bind.map_callback(function() - actions.stage_hunk() - end) - :with_buffer(buf) - :with_desc("git: Stage hunk"), - ["v|gs"] = bind.map_callback(function() - actions.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end) - :with_buffer(buf) - :with_desc("git: Stage hunk"), - ["n|gr"] = bind.map_callback(function() - actions.reset_hunk() - end) - :with_buffer(buf) + ["n|gs"] = map_callback(function() + actions.stage_hunk() + end) + :with_buffer(bufnr) + :with_noremap() + :with_desc("git: Toggle staging/unstaging of hunk"), + ["v|gs"] = map_callback(function() + actions.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + :with_buffer(bufnr) + :with_noremap() + :with_desc("git: Toggle staging/unstaging of selected hunk"), + ["n|gr"] = map_callback(function() + actions.reset_hunk() + end) + :with_buffer(bufnr) + :with_noremap() :with_desc("git: Reset hunk"), - ["v|gr"] = bind.map_callback(function() - actions.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end) - :with_buffer(buf) + ["v|gr"] = map_callback(function() + actions.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + :with_buffer(bufnr) + :with_noremap() :with_desc("git: Reset hunk"), - ["n|gR"] = bind.map_callback(function() - actions.reset_buffer() - end) - :with_buffer(buf) + ["n|gR"] = map_callback(function() + actions.reset_buffer() + end) + :with_buffer(bufnr) + :with_noremap() :with_desc("git: Reset buffer"), - ["n|gp"] = bind.map_callback(function() - actions.preview_hunk() - end) - :with_buffer(buf) + ["n|gp"] = map_callback(function() + actions.preview_hunk() + end) + :with_buffer(bufnr) + :with_noremap() :with_desc("git: Preview hunk"), - ["n|gb"] = bind.map_callback(function() - actions.blame_line({ full = true }) - end) - :with_buffer(buf) + ["n|gb"] = map_callback(function() + actions.blame_line({ full = true }) + end) + :with_buffer(bufnr) + :with_noremap() :with_desc("git: Blame line"), -- Text objects - ["ox|ih"] = bind.map_cu("Gitsigns select_hunk"):with_silent():with_buffer(buf), + ["ox|ih"] = map_callback(function() + actions.select_hunk() + end) + :with_buffer(bufnr) + :with_noremap(), } bind.nvim_load_mapping(map) end From 31005ccdeb41f1d935c8d7c22b72aacca75ef669 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 02:01:34 +0000 Subject: [PATCH 15/15] chore(lockfile): auto update lazy-lock.json --- lazy-lock.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 7128abfa6..689a875ed 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -22,12 +22,12 @@ "crates.nvim": { "branch": "main", "commit": "bd35b13e94a292ee6e32c351e05ca2202dc9f070" }, "csv.vim": { "branch": "master", "commit": "44aeb7e26e8b42f7c14c328f16ac4744ae53b22c" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dropbar.nvim": { "branch": "master", "commit": "eea7f4af890895fe3acb7f6435483c4324999673" }, + "dropbar.nvim": { "branch": "master", "commit": "b27bb0353cb34bded65a8911e7d232b12100568b" }, "edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" }, "fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf": { "branch": "master", "commit": "c13228f34623b856bd22a963959f4655cbfac947" }, + "fzf": { "branch": "master", "commit": "8179ca5eaa9241c71573a4f65ab34d21b8e3efb0" }, "fzy-lua-native": { "branch": "master", "commit": "9d720745d5c2fb563c0d86c17d77612a3519c506" }, "gitsigns.nvim": { "branch": "main", "commit": "d8918f06624dd53b9a82bd0e29c31bcfd541b40d" }, "glance.nvim": { "branch": "master", "commit": "1a08824835d7582457b67acbe23ca33487912a5e" }, @@ -53,22 +53,22 @@ "nvim-bqf": { "branch": "main", "commit": "ebb6d2689e4427452180f17c53f29f7e460236f1" }, "nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-dap": { "branch": "master", "commit": "1c96e487dd4180edc5a3c075ea1f03b6b751ef4f" }, + "nvim-dap": { "branch": "master", "commit": "1fdfe74661170ce58d37dc46259448987ffe706c" }, "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, "nvim-highlight-colors": { "branch": "main", "commit": "68a4df620cf58e2c7336e53738e8cf3a522ad694" }, - "nvim-lspconfig": { "branch": "master", "commit": "b4d65bce97795438ab6e1974b3672c17a4865e3c" }, + "nvim-lspconfig": { "branch": "master", "commit": "e5bf88e5ea1c4cea5ea96b1e970cb264f7a401a1" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-scrollview": { "branch": "main", "commit": "e8ad0e0f9c38c1bf3b03e3266cb6ecf3967d6e47" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, - "nvim-tree.lua": { "branch": "master", "commit": "fee1da88972f5972a8296813f6c00d7598325ebd" }, + "nvim-tree.lua": { "branch": "master", "commit": "d05881f65f0a653db8d830ccc4d2e07d6a720628" }, "nvim-treehopper": { "branch": "master", "commit": "e87002968983ed23836dfad53bcf023e609db42d" }, - "nvim-treesitter": { "branch": "master", "commit": "f3d7c0dafcbc86c4d63f765649c884a03bc1360a" }, + "nvim-treesitter": { "branch": "master", "commit": "d34e62afd3e483fe0fa2f24b6323f3bb1d35ddcc" }, "nvim-treesitter-context": { "branch": "master", "commit": "bece284c5322ddf6946fa4bdc383a2bc033269d7" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-web-devicons": { "branch": "master", "commit": "37334adf4517fecfd97c0b44e1d4718e377e9e52" }, + "nvim-web-devicons": { "branch": "master", "commit": "92833cd8c646c92f9013aaaa05aefa18bce74c45" }, "paint.nvim": { "branch": "main", "commit": "ef6f717a8669619ebbd098fb72f85115d64c6c92" }, "persisted.nvim": { "branch": "main", "commit": "8a25e7028d44645616a503b07b84be62da2fee86" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, @@ -77,11 +77,11 @@ "render-markdown.nvim": { "branch": "main", "commit": "ad055861d17afe058bd835e82292e14a64b51b1d" }, "rustaceanvim": { "branch": "master", "commit": "e15c262f81e8adb139ef3e3de775493d377919a2" }, "search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" }, - "smart-splits.nvim": { "branch": "master", "commit": "4a231987665d3c6e02ca88833d050e918afe3e1e" }, + "smart-splits.nvim": { "branch": "master", "commit": "bfb5e63bd4639439b48815f46636dbd52b19b1bd" }, "smartyank.nvim": { "branch": "master", "commit": "0a4554a4ea4cad73dab0a15e559f2128ca03c7b2" }, "sniprun": { "branch": "master", "commit": "67ac2d84d03f3b857d59571ff5fefb6080dffa2d" }, "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, - "telescope-frecency.nvim": { "branch": "master", "commit": "cf19bb00e8cd68c54e7cd156efcdc7d978bd4b89" }, + "telescope-frecency.nvim": { "branch": "master", "commit": "dcb8e54bc38fc679a42433bb5cec3ea15d5a3149" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, "telescope-live-grep-args.nvim": { "branch": "master", "commit": "649b662a8f476fd2c0289570764459e95ebaa3f3" }, "telescope-undo.nvim": { "branch": "main", "commit": "2971cc9f193ec09e0c5de3563f99cbea16b63f10" },