Compare commits
1 commit
a25b541650
...
530badbabd
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 530badbabd |
|
@ -1,6 +1,15 @@
|
||||||
local gitsigns = require("gitsigns")
|
local gitsigns = require("gitsigns")
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
|
|
||||||
|
--- Transform `f` into a function which acts on the current visual selection
|
||||||
|
local function make_visual(f)
|
||||||
|
return function()
|
||||||
|
local first = vim.fn.line("v")
|
||||||
|
local last = vim.fn.line(".")
|
||||||
|
f({ first, last })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
gitsigns.setup({
|
gitsigns.setup({
|
||||||
current_line_blame_opts = {
|
current_line_blame_opts = {
|
||||||
-- Show the blame quickly
|
-- Show the blame quickly
|
||||||
|
@ -46,10 +55,10 @@ local visual = {
|
||||||
-- Only the actual command can make use of the visual selection...
|
-- Only the actual command can make use of the visual selection...
|
||||||
["<leader>g"] = {
|
["<leader>g"] = {
|
||||||
name = "Git",
|
name = "Git",
|
||||||
p = { ":Gitsigns preview_hunk<CR>", "Preview selection" },
|
p = { gitsigns.preview_hunk, "Preview selection" },
|
||||||
r = { ":Gitsigns reset_hunk<CR>", "Restore selection" },
|
r = { make_visual(gitsigns.reset_hunk), "Restore selection" },
|
||||||
s = { ":Gitsigns stage_hunk<CR>", "Stage selection" },
|
s = { make_visual(gitsigns.stage_hunk), "Stage selection" },
|
||||||
u = { ":Gitsigns undo_stage_hunk<CR>", "Undo stage selection" },
|
u = { gitsigns.undo_stage_hunk, "Undo stage hunk" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue