home: vim: git: use 'partial'
All checks were successful
ci/woodpecker/push/check Pipeline was successful
All checks were successful
ci/woodpecker/push/check Pipeline was successful
This commit is contained in:
parent
65d036f473
commit
e7082b885d
|
@ -1,4 +1,5 @@
|
||||||
local gitsigns = require("gitsigns")
|
local gitsigns = require("gitsigns")
|
||||||
|
local utils = require("ambroisie.utils")
|
||||||
local wk = require("which-key")
|
local wk = require("which-key")
|
||||||
|
|
||||||
--- Transform `f` into a function which acts on the current visual selection
|
--- Transform `f` into a function which acts on the current visual selection
|
||||||
|
@ -11,7 +12,6 @@ local function make_visual(f)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function nav_hunk(dir)
|
local function nav_hunk(dir)
|
||||||
return function()
|
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then
|
||||||
local map = {
|
local map = {
|
||||||
prev = "[c",
|
prev = "[c",
|
||||||
|
@ -21,7 +21,6 @@ local function nav_hunk(dir)
|
||||||
else
|
else
|
||||||
gitsigns.nav_hunk(dir)
|
gitsigns.nav_hunk(dir)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
gitsigns.setup({
|
gitsigns.setup({
|
||||||
|
@ -33,8 +32,8 @@ gitsigns.setup({
|
||||||
|
|
||||||
local keys = {
|
local keys = {
|
||||||
-- Navigation
|
-- Navigation
|
||||||
["[c"] = { nav_hunk("prev"), "Previous hunk/diff" },
|
["[c"] = { utils.partial(nav_hunk, "prev"), "Previous hunk/diff" },
|
||||||
["]c"] = { nav_hunk("next"), "Next hunk/diff" },
|
["]c"] = { utils.partial(nav_hunk, "next"), "Next hunk/diff" },
|
||||||
|
|
||||||
-- Commands
|
-- Commands
|
||||||
["<leader>g"] = {
|
["<leader>g"] = {
|
||||||
|
|
Loading…
Reference in a new issue