mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(gitsigns): reworked as suggested in PR comments
This commit is contained in:
parent
397e1c3a2b
commit
b3ac8a8aec
3 changed files with 42 additions and 9 deletions
10
NEWS.md
10
NEWS.md
|
|
@ -20,10 +20,12 @@ Going forward, **LazyVim** requires **Neovim** `>= 0.11.2`, and drops support fo
|
|||
|
||||
### Keymaps
|
||||
|
||||
- `<leader>hq` to show hunks as Quickfix [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>hQ` to show hunks as Quickfix (all files) [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>tb` to toggle current line blame [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>tw` to toggle word diff [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>uH` to toggle LSP Codelens [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
|
||||
- `<leader>sp` to pick a picker [fzf-lua](https://github.com/ibhagwan/fzf-lua)
|
||||
- `<leader>xh` to show file hunks as Quickfix [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>xH` to show project hunks as Quickfix [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>uB` to toggle current line blame [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>uW` to toggle word diff [gitsigns](https://github.com/lewis6991/gitsigns.nvim)
|
||||
- `<leader>rI` to inline function [refactoring](https://github.com/ThePrimeagen/refactoring.nvim)
|
||||
|
||||
## 14.x
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ return {
|
|||
{ "<leader>f", group = "file/find" },
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gh", group = "hunks" },
|
||||
{ "<leader>gt", group = "toggle" },
|
||||
{ "<leader>q", group = "quit/session" },
|
||||
{ "<leader>s", group = "search" },
|
||||
{ "<leader>u", group = "ui" },
|
||||
|
|
@ -184,11 +183,10 @@ return {
|
|||
map("n", "<leader>ghB", function() gs.blame() end, "Blame Buffer")
|
||||
map("n", "<leader>ghd", gs.diffthis, "Diff This")
|
||||
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
|
||||
map("n", "<leader>ghq", gs.setqflist, "Show hunks as Quickfix")
|
||||
map("n", "<leader>ghQ", function() gs.setqflist("all") end, "Show hunks as Quickfix (all)")
|
||||
map("n", "<leader>gtb", gs.toggle_current_line_blame, "Toggle current line blame")
|
||||
map("n", "<leader>gtw", gs.toggle_word_diff, "Toggle word diff")
|
||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
|
||||
|
||||
map("n", "<leader>xh", gs.setqflist, "Git hunks (file)")
|
||||
map("n", "<leader>xH", function() gs.setqflist("all") end, "Git hunks (all)")
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
|
@ -204,6 +202,38 @@ return {
|
|||
require("gitsigns").toggle_signs(state)
|
||||
end,
|
||||
}):map("<leader>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("<leader>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("<leader>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("<leader>uH")
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ return {
|
|||
{ "<leader>sl", "<cmd>FzfLua loclist<cr>", desc = "Location List" },
|
||||
{ "<leader>sM", "<cmd>FzfLua man_pages<cr>", desc = "Man Pages" },
|
||||
{ "<leader>sm", "<cmd>FzfLua marks<cr>", desc = "Jump to Mark" },
|
||||
{ "<leader>sp", "<cmd>FzfLua builtin fuzzy=true<cr>", desc = "FZF pickers" },
|
||||
{ "<leader>sR", "<cmd>FzfLua resume<cr>", desc = "Resume" },
|
||||
{ "<leader>sq", "<cmd>FzfLua quickfix<cr>", desc = "Quickfix List" },
|
||||
{ "<leader>sw", LazyVim.pick("grep_cword"), desc = "Word (Root Dir)" },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue