Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prompt for nix-shell and init.zsh hook for pretzo
- Loading branch information
Showing
2 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
# Source module files. | ||
source "${0:h}/nix.plugin.zsh" || return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
# Nix Install | ||
# alias ni='nix-env -iA' | ||
alias ni='nix-env -iA' | ||
|
||
# Nix Search | ||
# alias ns='nix-env -qaP' | ||
alias ns='nix-env -qaP' | ||
|
||
function prompt_nix_shell_precmd { | ||
if [[ ${IN_NIX_SHELL} -eq 1 ]] then | ||
if [[ -n ${IN_WHICH_NIX_SHELL} ]] then | ||
NIX_SHELL_NAME=": ${IN_WHICH_NIX_SHELL}" | ||
fi | ||
NIX_PROMPT="%F{8}[%F{3}nix-shell${NIX_SHELL_NAME}%F{8}]%f" | ||
if [[ $PROMPT != *"$NIX_PROMPT"* ]] then | ||
PROMPT="$NIX_PROMPT $PROMPT" | ||
fi | ||
fi | ||
} | ||
|
||
function prompt_nix_shell_setup { | ||
autoload -Uz add-zsh-hook | ||
add-zsh-hook precmd prompt_nix_shell_precmd | ||
} | ||
|
||
prompt_nix_shell_setup "$@" |