pinwheel: Add zsh prompts when in nix shell and/or direnv

This commit is contained in:
Alexander Heldt
2024-06-15 13:12:39 +02:00
parent 066f4ad1a1
commit 7b4e3b4b01
2 changed files with 16 additions and 0 deletions

View File

@@ -54,6 +54,20 @@ in
"bindkey -v '^?' backward-delete-char" "bindkey -v '^?' backward-delete-char"
"bindkey '^a' beginning-of-line" "bindkey '^a' beginning-of-line"
"bindkey '^e' end-of-line" "bindkey '^e' end-of-line"
''
function prompt_in_nix_shell() {
if [[ -n "$IN_NIX_SHELL" ]]; then
p10k segment -f yellow -t "nix";
fi
}
''
''
function prompt_in_direnv() {
if [[ -n "$DIRENV_DIR" ]]; then
p10k segment -f yellow -t "direnv"
fi
}
''
]; ];
}; };
}; };

View File

@@ -54,6 +54,8 @@
command_execution_time # previous command duration command_execution_time # previous command duration
virtualenv # python virtual environment virtualenv # python virtual environment
prompt_char # prompt symbol prompt_char # prompt symbol
in_nix_shell
in_direnv
) )
# Right prompt segments. # Right prompt segments.