1
0
mirror of https://github.com/balkian/dotfiles.git synced 2025-08-23 16:02:19 +00:00

Different prompt color per hostname

This commit is contained in:
J. Fernando Sánchez
2016-10-08 00:56:35 +02:00
parent 32509d6482
commit 1e449408bb
2 changed files with 18 additions and 5 deletions

View File

@@ -21,6 +21,8 @@ _prompt_balkian_current_bg='NONE'
_prompt_balkian_segment_separator=' '
_prompt_balkian_start_time=$SECONDS
hostnamecolor=$(hostname | od | tr ' ' '\n' | awk '{total = total + $1}END{print 30 + (total % 6)}')
function prompt_balkian_start_segment {
local bg fg
[[ -n "$1" ]] && bg="%K{$1}" || bg="%k"
@@ -45,7 +47,7 @@ function prompt_balkian_end_segment {
}
function prompt_balkian_build_prompt {
prompt_balkian_start_segment black default '%(?::%F{red}✘ )%(!:%F{yellow}⚡ :)%(1j:%F{cyan}⚙ :)%F{green}%n%F{white}@%F{green}%m%f'
prompt_balkian_start_segment black default '%(?::%F{red}✘ )%(!:%F{yellow}⚡ :)%(1j:%F{cyan}⚙ :)%F{${hostnamecolor}}%n%F{white}@%F{${hostnamecolor}}%m%f'
prompt_balkian_start_segment black default '$_prompt_balkian_pwd'
if [[ -n "$git_info" ]]; then