feat: add lazygit keybindings

This commit is contained in:
n3oney 2023-05-03 00:24:34 +02:00
parent 933fa2a8ae
commit c6c04f0d1b
No known key found for this signature in database
GPG key ID: C786693DE727850E
2 changed files with 6 additions and 4 deletions

View file

@ -6,7 +6,6 @@
with lib;
with builtins; let
cfg = config.vim.terminal.toggleterm;
toggleKey = "<c-t>";
in {
config = mkMerge [
(
@ -14,7 +13,7 @@ in {
vim.startPlugins = [
"toggleterm-nvim"
];
vim.maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ''
@ -57,11 +56,10 @@ in {
hidden = true,
on_open = function(term)
vim.cmd("startinsert!")
vim.keymap.set( 't', [[${toggleKey}]], function() term:toggle() end, {silent = true, noremap = true, buffer = term.bufnr})
end
})
vim.keymap.set( 'n', [[<leader>gg]], function() lazygit:toggle() end, {silent = true, noremap = true})
vim.keymap.set('n', ${toJSON cfg.lazygit.mappings.open}, function() lazygit:toggle() end, {silent = true, noremap = true, desc = 'Open lazygit [toggleterm]'})
'';
}
)

View file

@ -37,6 +37,10 @@ with builtins; {
default = pkgs.lazygit;
description = "The package that should be used for lazygit. Setting it to null will attempt to use lazygit from your PATH";
};
mappings = {
open = mkMappingOption "Open lazygit [toggleterm]" "<leader>gg";
};
};
};
}