Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # AV Plugin from:
- #
- export __AV_PROMPT_DIR=$ZSH/plugins/av
- # Allow for functions in the prompt.
- setopt PROMPT_SUBST
- ## Enable auto-execution of functions.
- typeset -ga preexec_functions
- typeset -ga precmd_functions
- typeset -ga chpwd_functions
- # Append git functions needed for prompt.
- preexec_functions+='preexec_update_av_vars'
- precmd_functions+='precmd_update_av_vars'
- chpwd_functions+='chpwd_update_av_vars'
- ## Function definitions
- function preexec_update_av_vars() {
- case "$2" in
- git*)
- __EXECUTED_AV_COMMAND=1
- ;;
- esac
- }
- function precmd_update_av_vars() {
- if [ -n "$__EXECUTED_AV_COMMAND" ]; then
- update_current_av_vars
- unset __EXECUTED_AV_COMMAND
- fi
- }
- function chpwd_update_av_vars() {
- update_current_av_vars
- }
- function update_current_av_vars() {
- unset __CURRENT_AV_STATUS
- _AV_STATUS=`av status`
- if [ ! -z ${_AV_STATUS} ]; then
- __CURRENT_AV_STATUS="av"
- fi
- }
- function prompt_av_info() {
- if [ ! -z "$__CURRENT_AV_STATUS" ]; then
- echo "%{${fg[green]}%}$__CURRENT_AV_STATUS%{${fg[default]}%}"
- fi
- }
- # Set the prompt.
- RPROMPT='$(prompt_av_info)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement