Added simple theme for report server.
Its largely based on jackharrisonsherlock's common prompt, but has some different namespacing, a deterministic prompt color based on the hostname, and a few other minor changes. My plan is to add async git info to this, but this is the MVP for this.
This commit is contained in:
parent
af4a00dd3e
commit
40d8b3fdf3
58
zsh/modules/prompt/uncommon.zsh
Executable file
58
zsh/modules/prompt/uncommon.zsh
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
autoload -U colors \
|
||||||
|
&& colors
|
||||||
|
|
||||||
|
_UNCOMMON_COLOR_CURRENT_DIR=blue
|
||||||
|
_UNCOMMON_COLOR_RETURN_TRUE=yellow
|
||||||
|
_UNCOMMON_COLOR_RETURN_FALSE=red
|
||||||
|
_UNCOMMON_COLOR_BG_JOBS=yellow
|
||||||
|
_UNCOMMON_PROMPT_SYMBOL=${_UNCOMMON_PROMPT_SYMBOL:-'❯'}
|
||||||
|
|
||||||
|
if [ -z "$_UNCOMMON_HOSTNAME_COLOR" ] ; then
|
||||||
|
if [ -z "$_UNCOMMON_PROMPT_COLORS" ] ; then
|
||||||
|
_UNCOMMON_PROMPT_COLORS=(
|
||||||
|
$fg[blue]
|
||||||
|
$fg[cyan]
|
||||||
|
$fg[green]
|
||||||
|
$fg[magenta]
|
||||||
|
$fg[red]
|
||||||
|
$fg[white]
|
||||||
|
$fg[yellow]
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
local DETERMINISTIC_INT=$(( $(hostname | cksum | sed 's/[^0-9]*//g') % ${#_UNCOMMON_PROMPT_COLORS[@]} ))
|
||||||
|
export _UNCOMMON_HOSTNAME_COLOR=${_UNCOMMON_PROMPT_COLORS[$DETERMINISTIC_INT]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
PROMPT='$(_uncommon_host)$(_uncommon_current_dir)$(_uncommon_return_status)'
|
||||||
|
RPROMPT='$(_uncommon_time)'
|
||||||
|
|
||||||
|
_uncommon_host(){
|
||||||
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
|
me="%n@%m"
|
||||||
|
elif [[ "$LOGNAME" != "$USER" ]]; then
|
||||||
|
me="%n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $me ]]; then
|
||||||
|
echo "%{${_UNCOMMON_HOSTNAME_COLOR}%}$me%{$reset_color%}:"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_uncommon_current_dir(){
|
||||||
|
echo -n "%{$fg[$_UNCOMMON_COLOR_CURRENT_DIR]%}%c "
|
||||||
|
}
|
||||||
|
|
||||||
|
_uncommon_return_status() {
|
||||||
|
echo -n "%(?.%F{$_UNCOMMON_COLOR_RETURN_TRUE}.%F{$_UNCOMMON_COLOR_RETURN_FALSE})$_UNCOMMON_PROMPT_SYMBOL%f "
|
||||||
|
}
|
||||||
|
|
||||||
|
_uncommon_bg_jobs() {
|
||||||
|
bg_status="%{$fg[$_UNCOMMON_COLOR_BG_JOBS]%}%(1j.↓%j .)"
|
||||||
|
echo -n $bg_status
|
||||||
|
}
|
||||||
|
|
||||||
|
_uncommon_time(){
|
||||||
|
echo "%F{red} %D{%L:%M:%S}%r%f"
|
||||||
|
}
|
||||||
|
|
|
@ -60,10 +60,17 @@ zplug "${ZDIR}/modules/alias/", \
|
||||||
from:local, \
|
from:local, \
|
||||||
as:plugin
|
as:plugin
|
||||||
|
|
||||||
zplug "denysdovhan/spaceship-prompt", \
|
if [ -z "$SSH_CONNECTION" ] ; then
|
||||||
|
zplug "${ZDIR}/modules/prompt/",\
|
||||||
|
from:local,\
|
||||||
|
use:uncommon.zsh, \
|
||||||
|
as:theme
|
||||||
|
else
|
||||||
|
zplug "denysdovhan/spaceship-prompt", \
|
||||||
use:spaceship.zsh, \
|
use:spaceship.zsh, \
|
||||||
from:github, \
|
from:github, \
|
||||||
as:theme
|
as:theme
|
||||||
|
fi
|
||||||
|
|
||||||
env_loader zplug
|
env_loader zplug
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user