Use powerline-client if possible
This commit is contained in:
parent
23a59ba93d
commit
884a8b0d78
|
@ -1,3 +1,11 @@
|
||||||
|
if test -z "${POWERLINE_COMMAND}" ; then
|
||||||
|
if which powerline-client &>/dev/null ; then
|
||||||
|
export POWERLINE_COMMAND=powerline-client
|
||||||
|
else
|
||||||
|
export POWERLINE_COMMAND=powerline
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
_powerline_tmux_setenv() {
|
_powerline_tmux_setenv() {
|
||||||
if [[ -n "$TMUX" ]]; then
|
if [[ -n "$TMUX" ]]; then
|
||||||
tmux setenv -g TMUX_"$1"_$(tmux display -p "#D" | tr -d %) "$2"
|
tmux setenv -g TMUX_"$1"_$(tmux display -p "#D" | tr -d %) "$2"
|
||||||
|
@ -22,7 +30,7 @@ _powerline_prompt() {
|
||||||
local last_exit_code=$?
|
local last_exit_code=$?
|
||||||
[[ -z "$POWERLINE_OLD_PROMPT_COMMAND" ]] ||
|
[[ -z "$POWERLINE_OLD_PROMPT_COMMAND" ]] ||
|
||||||
eval $POWERLINE_OLD_PROMPT_COMMAND
|
eval $POWERLINE_OLD_PROMPT_COMMAND
|
||||||
PS1="$(powerline shell left -r bash_prompt --last_exit_code=$last_exit_code)"
|
PS1="$($POWERLINE_COMMAND shell left -r bash_prompt --last_exit_code=$last_exit_code)"
|
||||||
_powerline_tmux_set_pwd
|
_powerline_tmux_set_pwd
|
||||||
return $last_exit_code
|
return $last_exit_code
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
|
if-shell 'test -z "$POWERLINE_COMMAND"' 'if-shell "which powerline-client" "set-environment -g POWERLINE_COMMAND powerline-client" "set-environment -g POWERLINE_COMMAND powerline"'
|
||||||
set -g status on
|
set -g status on
|
||||||
set -g status-utf8 on
|
set -g status-utf8 on
|
||||||
set -g status-interval 2
|
set -g status-interval 2
|
||||||
set -g status-fg colour231
|
set -g status-fg colour231
|
||||||
set -g status-bg colour234
|
set -g status-bg colour234
|
||||||
set -g status-left-length 20
|
set -g status-left-length 20
|
||||||
set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]#(powerline tmux left)'
|
set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]#($POWERLINE_COMMAND tmux left)'
|
||||||
set -g status-right '#(powerline tmux right -R pane_id=`tmux display -p "#D"`)'
|
set -g status-right '#($POWERLINE_COMMAND tmux right -R pane_id=`tmux display -p "#D"`)'
|
||||||
set -g status-right-length 150
|
set -g status-right-length 150
|
||||||
set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[fg=colour249]#W "
|
set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[fg=colour249]#W "
|
||||||
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
|
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
|
||||||
|
# vim: ft=tmux
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
if test -z "${POWERLINE_COMMAND}" ; then
|
||||||
|
if which powerline-client &>/dev/null ; then
|
||||||
|
export POWERLINE_COMMAND=powerline-client
|
||||||
|
else
|
||||||
|
export POWERLINE_COMMAND=powerline
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
_powerline_tmux_setenv() {
|
_powerline_tmux_setenv() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
if [[ -n "$TMUX" ]]; then
|
if [[ -n "$TMUX" ]]; then
|
||||||
|
@ -27,8 +35,8 @@ _powerline_install_precmd() {
|
||||||
zpython 'powerline_setup()'
|
zpython 'powerline_setup()'
|
||||||
zpython 'del powerline_setup'
|
zpython 'del powerline_setup'
|
||||||
else
|
else
|
||||||
PS1='$(powerline shell left -r zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus")'
|
PS1='$($POWERLINE_COMMAND shell left -r zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus")'
|
||||||
RPS1='$(powerline shell right -r zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus")'
|
RPS1='$($POWERLINE_COMMAND shell right -r zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus")'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue