From b3ac8a8aec30d53ededa525eae76672bccf4c9b6 Mon Sep 17 00:00:00 2001 From: Oleg Kostyuk Date: Fri, 17 Apr 2026 00:03:55 +0200 Subject: [PATCH] feat(gitsigns): reworked as suggested in PR comments --- NEWS.md | 10 +++--- lua/lazyvim/plugins/editor.lua | 40 ++++++++++++++++++++--- lua/lazyvim/plugins/extras/editor/fzf.lua | 1 + 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/NEWS.md b/NEWS.md index 8a669a78..9bb6809a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -20,10 +20,12 @@ Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support fo ### Keymaps -- `hq` to show hunks as Quickfix [gitsigns](https://github.com/lewis6991/gitsigns.nvim) -- `hQ` to show hunks as Quickfix (all files) [gitsigns](https://github.com/lewis6991/gitsigns.nvim) -- `tb` to toggle current line blame [gitsigns](https://github.com/lewis6991/gitsigns.nvim) -- `tw` to toggle word diff [gitsigns](https://github.com/lewis6991/gitsigns.nvim) +- `uH` to toggle LSP Codelens [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) +- `sp` to pick a picker [fzf-lua](https://github.com/ibhagwan/fzf-lua) +- `xh` to show file hunks as Quickfix [gitsigns](https://github.com/lewis6991/gitsigns.nvim) +- `xH` to show project hunks as Quickfix [gitsigns](https://github.com/lewis6991/gitsigns.nvim) +- `uB` to toggle current line blame [gitsigns](https://github.com/lewis6991/gitsigns.nvim) +- `uW` to toggle word diff [gitsigns](https://github.com/lewis6991/gitsigns.nvim) - `rI` to inline function [refactoring](https://github.com/ThePrimeagen/refactoring.nvim) ## 14.x diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 4f86c3f9..00fb5667 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -72,7 +72,6 @@ return { { "f", group = "file/find" }, { "g", group = "git" }, { "gh", group = "hunks" }, - { "gt", group = "toggle" }, { "q", group = "quit/session" }, { "s", group = "search" }, { "u", group = "ui" }, @@ -184,11 +183,10 @@ return { map("n", "ghB", function() gs.blame() end, "Blame Buffer") map("n", "ghd", gs.diffthis, "Diff This") map("n", "ghD", function() gs.diffthis("~") end, "Diff This ~") - map("n", "ghq", gs.setqflist, "Show hunks as Quickfix") - map("n", "ghQ", function() gs.setqflist("all") end, "Show hunks as Quickfix (all)") - map("n", "gtb", gs.toggle_current_line_blame, "Toggle current line blame") - map("n", "gtw", gs.toggle_word_diff, "Toggle word diff") map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns Select Hunk") + + map("n", "xh", gs.setqflist, "Git hunks (file)") + map("n", "xH", function() gs.setqflist("all") end, "Git hunks (all)") end, }, }, @@ -204,6 +202,38 @@ return { require("gitsigns").toggle_signs(state) end, }):map("uG") + Snacks.toggle({ + name = "Git Line Blame", + get = function() + return require("gitsigns.config").config.current_line_blame + end, + set = function(state) + require("gitsigns").toggle_current_line_blame(state) + end, + }):map("uB") + Snacks.toggle({ + name = "Git Word Diff", + get = function() + return require("gitsigns.config").config.word_diff + end, + set = function(state) + require("gitsigns").toggle_word_diff(state) + end, + }):map("uW") + end, + }, + { + "neovim/nvim-lspconfig", + opts = function() + Snacks.toggle({ + name = "LSP Codelens", + get = function() + return vim.lsp.codelens.is_enabled() + end, + set = function(state) + vim.lsp.codelens.enable(state) + end, + }):map("uH") end, }, diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index 4f703405..3634b067 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -249,6 +249,7 @@ return { { "sl", "FzfLua loclist", desc = "Location List" }, { "sM", "FzfLua man_pages", desc = "Man Pages" }, { "sm", "FzfLua marks", desc = "Jump to Mark" }, + { "sp", "FzfLua builtin fuzzy=true", desc = "FZF pickers" }, { "sR", "FzfLua resume", desc = "Resume" }, { "sq", "FzfLua quickfix", desc = "Quickfix List" }, { "sw", LazyVim.pick("grep_cword"), desc = "Word (Root Dir)" },