From 4f2a71c2174a819c31a573138009ab749ff15f54 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Sun, 2 Apr 2023 10:38:06 +0200 Subject: [PATCH] Cleanup of zsh theme --- _oh-my-zsh/themes/lsambuc.zsh-theme | 39 ++++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/_oh-my-zsh/themes/lsambuc.zsh-theme b/_oh-my-zsh/themes/lsambuc.zsh-theme index 068f511..14444a7 100644 --- a/_oh-my-zsh/themes/lsambuc.zsh-theme +++ b/_oh-my-zsh/themes/lsambuc.zsh-theme @@ -1,30 +1,39 @@ -if [ "$(whoami)" = "root" ]; then USERCOLOR="red"; else USERCOLOR="green"; fi +if [ "$(whoami)" = "root" ] +then + USERCOLOR="red" +else + USERCOLOR="green" +fi -local return_code="%(?.. %{$fg[red]%}%?%{$reset_color%})" -local time_field="%{$fg_bold[blue]%}%D{%H:%M}" -local user_field="%{$fg_bold[$USERCOLOR]%}%n" -local path_field="%{$reset_color%}%20<..<%~%<<" +local reset_color="%b%u%s%k%f" +local field_color="%b%F{white}" +local sep_color="%B%F{white}" + +local time_field="%B%F{blue}%D{%H:%M}" +local user_field="%B%F{$USERCOLOR}%n" +local host_field="${field_color}%m" +local path_field="${field_color}%20<..<%~%<<" +local return_code="%(?.. %B%F{red}%?)" # With Git status -PROMPT='${time_field} %{$fg_bold[white]%}[${user_field}%{${reset_color}%}@%m%{$fg_bold[blue]%}:${path_field}%{$fg_bold[white]%}]$(git_prompt_info)${return_code} %{${fg_bold[yellow]}%}»%{${reset_color}%} ' +PROMPT='${time_field}${sep_color} [${user_field}${sep_color}@${host_field}${sep_color}:${path_field}${sep_color}]$(git_prompt_info)${return_code} %B%F{yellow}»${reset_color} ' # Without Git status -#PROMPT='${time_field} $fg_bold[white][${user_field}%{${reset_color}%}@%m%{$fg_bold[blue]%}:${path_field}$fg_bold[white]] %{${fg_bold[yellow]}%}»%{${reset_color}%} ' +#PROMPT='${time_field}${sep_color} [${user_field}${sep_color}@${host_field}${sep_color}:${path_field}${sep_color}]${return_code} %B%F{yellow}»${reset_color} ' # GIT Status theming -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[red]%}" +ZSH_THEME_GIT_PROMPT_PREFIX=" %b%F{red}" ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗" +ZSH_THEME_GIT_PROMPT_CLEAN="%B%F{green}✔" +ZSH_THEME_GIT_PROMPT_DIRTY="%B%F{red}✗" # LS colors, made with http://geoff.greer.fm/lscolors/ #export LSCOLORS="Gxfxcxdxbxegedabagacad" -#export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:' +#export LS_COLORS="rs=0:di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43" - -# Redefine git_prompt_info +# Redefine git_prompt_info, just grab the branch name, if there is one. +# This is much faster in large repositories. function git_prompt_info () { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return + ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX" } -