mirror of
https://github.com/powerline/powerline.git
synced 2025-07-31 01:35:40 +02:00
Merge remote-tracking branch 'zyx-i/auto-use-powerline-client' into develop
This commit is contained in:
commit
291832d707
@ -526,3 +526,18 @@ use ``c.Powerline.KEY``. Supported ``KEY`` strings or keyword argument names:
|
|||||||
Sets directory where configuration should be read from. If present, no
|
Sets directory where configuration should be read from. If present, no
|
||||||
default locations are searched for configuration. No expansions are
|
default locations are searched for configuration. No expansions are
|
||||||
performed thus you cannot use paths starting with ``~/``.
|
performed thus you cannot use paths starting with ``~/``.
|
||||||
|
|
||||||
|
Prompt command
|
||||||
|
--------------
|
||||||
|
|
||||||
|
In addition to the above configuration options you can use
|
||||||
|
``$POWERLINE_COMMAND`` environment variable to tell shell or tmux to use
|
||||||
|
specific powerline implementation. This is mostly useful for putting powerline
|
||||||
|
into different directory or replacing ``powerline`` script with
|
||||||
|
``powerline-client`` for performance reasons.
|
||||||
|
|
||||||
|
Note: ``$POWERLINE_COMMAND`` appears in shell scripts without quotes thus you
|
||||||
|
can specify additional parameters in bash. In zsh you will have to make
|
||||||
|
``$POWERLINE_COMMAND`` an array parameter to achieve the same result. In tmux it
|
||||||
|
is passed to ``eval`` and depends on the shell used. POSIX-compatible shells,
|
||||||
|
zsh, bash and fish will split this variable in this case.
|
||||||
|
@ -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]#(eval $POWERLINE_COMMAND tmux left)'
|
||||||
set -g status-right '#(powerline tmux right -R pane_id=`tmux display -p "#D"`)'
|
set -g status-right '#(eval $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…
x
Reference in New Issue
Block a user