]> arthur.barton.de Git - ax-zsh.git/blob - plugins/powerline-shell/powerline-shell.zshrc
Allow plugins to indicate "ignored" and "optional" state
[ax-zsh.git] / plugins / powerline-shell / powerline-shell.zshrc
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # powerline-shell.zshrc: "powerline-shell" integration.
3
4 [[ "$TERM" = "linux" ]] && return 911
5
6 if [[ -z "$POWERLINE_SHELL" ]]; then
7         for p (
8                 "$HOME/powerline-shell.py"
9                 "$HOME/.powerline-shell.py"
10         ); do
11                 [[ -r "$p" ]] || continue
12                 POWERLINE_SHELL="$p"
13                 break
14         done
15         unset p
16 fi
17
18 [[ -r "$POWERLINE_SHELL" ]] || return 1
19
20 function powerline_precmd() {
21         PS1="$(
22                 $POWERLINE_SHELL \
23                         --shell zsh \
24                         --mode ${POWERLINE_SHELL_MODE:-"compatible"} \
25                         --colorize-hostname \
26                         --cwd-mode ${POWERLINE_SHELL_CWD_MODE:-"fancy"} \
27                         --cwd-max-depth ${POWERLINE_SHELL_CWD_DEPTH:-4} \
28                         $? 2>/dev/null
29         )"
30 }
31
32 # Make sure "powerline_precmd" isn't installed already
33 for s in "${precmd_functions[@]}"; do
34         [[ "$s" = "powerline_precmd" ]] && return
35 done
36
37 precmd_functions+=(powerline_precmd)