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 lib;
with builtins; let with builtins; let
cfg = config.vim.terminal.toggleterm; cfg = config.vim.terminal.toggleterm;
toggleKey = "<c-t>";
in { in {
config = mkMerge [ config = mkMerge [
( (
@ -57,11 +56,10 @@ in {
hidden = true, hidden = true,
on_open = function(term) on_open = function(term)
vim.cmd("startinsert!") vim.cmd("startinsert!")
vim.keymap.set( 't', [[${toggleKey}]], function() term:toggle() end, {silent = true, noremap = true, buffer = term.bufnr})
end 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; default = pkgs.lazygit;
description = "The package that should be used for lazygit. Setting it to null will attempt to use lazygit from your PATH"; 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";
};
}; };
}; };
} }