powerline-no
This commit is contained in:
parent
f03d13f7db
commit
af463d0f77
2 changed files with 48 additions and 37 deletions
|
@ -48,31 +48,36 @@ function preexec() {
|
|||
__TIMER=$EPOCHREALTIME
|
||||
}
|
||||
|
||||
function powerline_precmd() {
|
||||
local __ERRCODE=$?
|
||||
local __DURATION=0
|
||||
if command -v powerline-go > /dev/null
|
||||
then
|
||||
function powerline_precmd() {
|
||||
local __ERRCODE=$?
|
||||
local __DURATION=0
|
||||
|
||||
if [ -n $__TIMER ]; then
|
||||
local __ERT=$EPOCHREALTIME
|
||||
__DURATION="$(($__ERT - ${__TIMER:-__ERT}))"
|
||||
fi
|
||||
|
||||
echo -en "\033]; ${USER}@${HOST} $PWD\007"
|
||||
# echo -en "… $\r"
|
||||
eval "$(powerline-go -shell zsh -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
||||
unset __TIMER
|
||||
}
|
||||
|
||||
function install_powerline_precmd() {
|
||||
for s in "${precmd_functions[@]}"; do
|
||||
if [ "$s" = "powerline_precmd" ]; then
|
||||
return
|
||||
if [ -n $__TIMER ]; then
|
||||
local __ERT=$EPOCHREALTIME
|
||||
__DURATION="$(($__ERT - ${__TIMER:-__ERT}))"
|
||||
fi
|
||||
done
|
||||
precmd_functions+=(powerline_precmd)
|
||||
}
|
||||
|
||||
install_powerline_precmd
|
||||
echo -en "\033]; ${USER}@${HOST} $PWD\007"
|
||||
# echo -en "… $\r"
|
||||
eval "$(powerline-go -shell zsh -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
||||
unset __TIMER
|
||||
}
|
||||
|
||||
function install_powerline_precmd() {
|
||||
for s in "${precmd_functions[@]}"; do
|
||||
if [ "$s" = "powerline_precmd" ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
precmd_functions+=(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
|
||||
if [ $TERM = "linux" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue