powerline-no
This commit is contained in:
parent
f03d13f7db
commit
af463d0f77
|
@ -13,11 +13,13 @@ HISTCONTROL=ignoreboth:erasedups
|
||||||
|
|
||||||
# Prompt customization
|
# Prompt customization
|
||||||
|
|
||||||
INTERACTIVE_BASHPID_TIMER="${HOME}/.cache/bash_timer_$$"
|
if command -v powerline-go > /dev/null
|
||||||
|
then
|
||||||
|
INTERACTIVE_BASHPID_TIMER="${HOME}/.cache/bash_timer_$$"
|
||||||
|
|
||||||
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
|
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
|
||||||
|
|
||||||
function _update_ps1() {
|
function _update_ps1() {
|
||||||
local __ERRCODE=$?
|
local __ERRCODE=$?
|
||||||
|
|
||||||
local __DURATION=0
|
local __DURATION=0
|
||||||
|
@ -30,9 +32,13 @@ function _update_ps1() {
|
||||||
|
|
||||||
# echo -en "… $\r"
|
# echo -en "… $\r"
|
||||||
eval "$(powerline-go -shell bash -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
eval "$(powerline-go -shell bash -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
||||||
|
|
||||||
|
else
|
||||||
|
export PS1="\[\e]2;\u@\H \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
|
||||||
|
fi
|
||||||
|
|
||||||
# Completion
|
# Completion
|
||||||
trysource /usr/share/bash-completion/bash_completion
|
trysource /usr/share/bash-completion/bash_completion
|
||||||
|
|
|
@ -48,7 +48,9 @@ function preexec() {
|
||||||
__TIMER=$EPOCHREALTIME
|
__TIMER=$EPOCHREALTIME
|
||||||
}
|
}
|
||||||
|
|
||||||
function powerline_precmd() {
|
if command -v powerline-go > /dev/null
|
||||||
|
then
|
||||||
|
function powerline_precmd() {
|
||||||
local __ERRCODE=$?
|
local __ERRCODE=$?
|
||||||
local __DURATION=0
|
local __DURATION=0
|
||||||
|
|
||||||
|
@ -61,18 +63,21 @@ function powerline_precmd() {
|
||||||
# echo -en "… $\r"
|
# echo -en "… $\r"
|
||||||
eval "$(powerline-go -shell zsh -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
eval "$(powerline-go -shell zsh -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
||||||
unset __TIMER
|
unset __TIMER
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_powerline_precmd() {
|
function install_powerline_precmd() {
|
||||||
for s in "${precmd_functions[@]}"; do
|
for s in "${precmd_functions[@]}"; do
|
||||||
if [ "$s" = "powerline_precmd" ]; then
|
if [ "$s" = "powerline_precmd" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
precmd_functions+=(powerline_precmd)
|
precmd_functions+=(powerline_precmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
install_powerline_precmd
|
install_powerline_precmd
|
||||||
|
else
|
||||||
|
export PS1="\[\e]2;\u@\H \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
|
||||||
|
fi
|
||||||
|
|
||||||
# Cursor based on mode
|
# Cursor based on mode
|
||||||
if [ $TERM = "linux" ]; then
|
if [ $TERM = "linux" ]; then
|
||||||
|
|
Loading…
Reference in a new issue