{ nix2lua, vim, lib, ... }: with nix2lua.lib; { configs ? { } , keymaps ? [ { mode = "n"; bind = "]h"; command = raw "next_hunk"; } { mode = "n"; bind = "[h"; command = raw "prev_hunk"; } { mode = "n"; bind = "gs"; command = raw "gs.stage_hunk"; } { mode = "n"; bind = "gr"; command = raw "gs.reset_hunk"; } { mode = "n"; bind = "gu"; command = raw "gs.undo_stage_hunk"; } { mode = "n"; bind = "gp"; command = raw "gs.preview_hunk"; } { mode = "n"; bind = "gb"; command = lambda0 (call "gs.blame_line" { full = true; }); } { mode = "n"; bind = "gd"; command = raw "gs.diffthis"; } { mode = "n"; bind = "gD"; command = lambda0 (call "gs.diffthis" "~"); } { mode = "n"; bind = "gtb"; command = raw "gs.toggle_current_line_blame"; } { mode = "n"; bind = "gtd"; command = raw "gs.toggle_deleted"; } ] }: let bufferedKeymaps = map (args: lib.recursiveUpdate args { opts.buffer = var "bufnr"; }) keymaps; in { gitsigns-nvim = [ (local (func "on_attach" [ "bufnr" ] ( [ (local (set "gs" (var "package.loaded.gitsigns"))) (local (func0 "next_hunk" (ifelse (var "vim.wo.diff") (call1 "vim.cmd.normal" [ "]h" (nf "bang" true) ]) (call1 "gs.nav_hunk" "next") ) )) (local (func0 "prev_hunk" (ifelse (var "vim.wo.diff") (call1 "vim.cmd.normal" [ "[h" (nf "bang" true) ]) (call1 "gs.nav_hunk" "prev")) )) ] ++ map vim.keymap.set bufferedKeymaps ))) (pipe1 (require "gitsigns") (call "setup" (configs // { on_attach = var "on_attach"; })) ) ]; }