1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

lazygit: fix nushell and fish integrations

This commit is contained in:
jaredmontoya 2025-11-01 23:43:52 +01:00 committed by Austin Horstman
parent 87044c5722
commit ae22fa930e

View file

@ -85,10 +85,15 @@ in
programs = programs =
let let
lazygitNewDirFilePath =
if config.home.preferXdgDirectories then
"${config.xdg.cacheHome}/lazygit/newdir"
else
"~/.lazygit/newdir";
bashIntegration = '' bashIntegration = ''
${cfg.shellWrapperName}() ${cfg.shellWrapperName}() {
{ export LAZYGIT_NEW_DIR_FILE=${lazygitNewDirFilePath}
export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir
lazygit "$@" lazygit "$@"
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
cd "$(cat $LAZYGIT_NEW_DIR_FILE)" cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
@ -98,17 +103,19 @@ in
''; '';
fishIntegration = '' fishIntegration = ''
set -x LAZYGIT_NEW_DIR_FILE ~/.lazygit/newdir function ${cfg.shellWrapperName}
command lazygit $argv set -x LAZYGIT_NEW_DIR_FILE ${lazygitNewDirFilePath}
if test -f $LAZYGIT_NEW_DIR_FILE command lazygit $argv
cd (cat $LAZYGIT_NEW_DIR_FILE) if test -f $LAZYGIT_NEW_DIR_FILE
rm -f $LAZYGIT_NEW_DIR_FILE cd (cat $LAZYGIT_NEW_DIR_FILE)
rm -f $LAZYGIT_NEW_DIR_FILE
end
end end
''; '';
nushellIntegration = '' nushellIntegration = ''
def --env ${cfg.shellWrapperName} [...args] { def --env ${cfg.shellWrapperName} [...args] {
$env.LAZYGIT_NEW_DIR_FILE = "~/.lazygit/newdir" $env.LAZYGIT_NEW_DIR_FILE = "${lazygitNewDirFilePath}" | path expand
lazygit ...$args lazygit ...$args
if ($env.LAZYGIT_NEW_DIR_FILE | path exists) { if ($env.LAZYGIT_NEW_DIR_FILE | path exists) {
cd (open $env.LAZYGIT_NEW_DIR_FILE) cd (open $env.LAZYGIT_NEW_DIR_FILE)