Skip to content

Commit

Permalink
prompt for nix-shell and init.zsh hook for pretzo
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas committed Nov 27, 2015
1 parent a261022 commit 9b7d216
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions init.zsh
@@ -0,0 +1,3 @@

# Source module files.
source "${0:h}/nix.plugin.zsh" || return 1
23 changes: 21 additions & 2 deletions nix.plugin.zsh
@@ -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 "$@"

0 comments on commit 9b7d216

Please sign in to comment.