Compare commits
No commits in common. "e7082b885d3a476b4fdcc633b6a6dab14d3eaa35" and "a25b54165094b83ef30613a577a051b2a8e707b4" have entirely different histories.
e7082b885d
...
a25b541650
|
@ -48,22 +48,4 @@ M.list_lsp_clients = function(bufnr)
|
|||
return names
|
||||
end
|
||||
|
||||
--- partially apply a function with given arguments
|
||||
M.partial = function(f, ...)
|
||||
local a = { ... }
|
||||
local a_len = select("#", ...)
|
||||
|
||||
return function(...)
|
||||
local tmp = { ... }
|
||||
local tmp_len = select("#", ...)
|
||||
|
||||
-- Merge arg lists
|
||||
for i = 1, tmp_len do
|
||||
a[a_len + i] = tmp[i]
|
||||
end
|
||||
|
||||
return f(unpack(a, 1, a_len + tmp_len))
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local gitsigns = require("gitsigns")
|
||||
local utils = require("ambroisie.utils")
|
||||
local wk = require("which-key")
|
||||
|
||||
--- Transform `f` into a function which acts on the current visual selection
|
||||
|
@ -12,14 +11,16 @@ local function make_visual(f)
|
|||
end
|
||||
|
||||
local function nav_hunk(dir)
|
||||
if vim.wo.diff then
|
||||
local map = {
|
||||
prev = "[c",
|
||||
next = "]c",
|
||||
}
|
||||
vim.cmd.normal({ map[dir], bang = true })
|
||||
else
|
||||
gitsigns.nav_hunk(dir)
|
||||
return function()
|
||||
if vim.wo.diff then
|
||||
local map = {
|
||||
prev = "[c",
|
||||
next = "]c",
|
||||
}
|
||||
vim.cmd.normal({ map[dir], bang = true })
|
||||
else
|
||||
gitsigns.nav_hunk(dir)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -32,8 +33,8 @@ gitsigns.setup({
|
|||
|
||||
local keys = {
|
||||
-- Navigation
|
||||
["[c"] = { utils.partial(nav_hunk, "prev"), "Previous hunk/diff" },
|
||||
["]c"] = { utils.partial(nav_hunk, "next"), "Next hunk/diff" },
|
||||
["[c"] = { nav_hunk("prev"), "Previous hunk/diff" },
|
||||
["]c"] = { nav_hunk("next"), "Next hunk/diff" },
|
||||
|
||||
-- Commands
|
||||
["<leader>g"] = {
|
||||
|
|
Loading…
Reference in a new issue