Added shortcut for lazygit in a popup

This commit is contained in:
alejandro-angulo 2024-10-06 09:57:13 -07:00
parent 52016deafe
commit 323f5e5b1f
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6

View file

@ -58,7 +58,8 @@ in {
tmuxPlugins.vim-tmux-navigator
];
extraConfig = ''
extraConfig =
''
# Scrolling with mouse wheel scrolls output instead of previous commands
setw -g mouse on
@ -72,6 +73,17 @@ in {
bind C-j display-popup -E "${pkgs.tmux-sessionizer}/bin/tms switch"
bind C-w display-popup -E "${pkgs.tmux-sessionizer}/bin/tms windows"
bind C-s command-prompt -p "Rename active session to:" "run-shell '${pkgs.tmux-sessionizer}/bin/tms rename %1'"
''
+ lib.strings.optionalString config.programs.lazygit.enable ''
# Open lazygit in a popup
# Spins up a new session with a '-lg' suffix (hitting the shortcut
# toggles between attaching and detaching)
bind C-g if-shell "[[ $(tmux display-message -p '#S') == *-lg ]]" {
detach-client
} {
display-popup -h 90% -w 90% -E "tmux new-session -A -s $(tmux display-message -p '#S')-lg ${pkgs.lazygit}/bin/lazygit"
}
'';
};