diff options
Diffstat (limited to 'themes')
-rw-r--r-- | themes/fishy.zsh-theme | 18 | ||||
-rw-r--r-- | themes/pygmalion-virtualenv.zsh-theme | 10 | ||||
-rw-r--r-- | themes/pygmalion.zsh-theme | 10 | ||||
-rw-r--r-- | themes/trapd00r.zsh-theme | 2 |
4 files changed, 27 insertions, 13 deletions
diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index 00a60f45b..2b8d559e5 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -1,12 +1,18 @@ # ZSH Theme emulating the Fish shell's default prompt. _fishy_collapsed_wd() { - echo $(pwd | perl -pe ' - BEGIN { - binmode STDIN, ":encoding(UTF-8)"; - binmode STDOUT, ":encoding(UTF-8)"; - }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g -') + local i pwd + pwd=("${(s:/:)PWD/#$HOME/~}") + if (( $#pwd > 1 )); then + for i in {1..$(($#pwd-1))}; do + if [[ "$pwd[$i]" = .* ]]; then + pwd[$i]="${${pwd[$i]}[1,2]}" + else + pwd[$i]="${${pwd[$i]}[1]}" + fi + done + fi + echo "${(j:/:)pwd}" } local user_color='green'; [ $UID -eq 0 ] && user_color='red' diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme index 605e3d10c..47b0b4fb1 100644 --- a/themes/pygmalion-virtualenv.zsh-theme +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -17,6 +17,8 @@ function _virtualenv_prompt_info { } prompt_setup_pygmalion(){ + setopt localoptions extendedglob + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" @@ -25,16 +27,18 @@ prompt_setup_pygmalion(){ base_prompt='$(_virtualenv_prompt_info)%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' - base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") - post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") + base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}} + post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}} autoload -U add-zsh-hook add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ + setopt localoptions extendedglob + local gitinfo=$(git_prompt_info) - local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") + local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" local prompt_length=${#exp_nocolor} diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index bd58db5f6..b13adfd5f 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -1,6 +1,8 @@ # Yay! High voltage and arrows! prompt_setup_pygmalion(){ + setopt localoptions extendedglob + ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" @@ -9,16 +11,18 @@ prompt_setup_pygmalion(){ base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} ' - base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") - post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") + base_prompt_nocolor=${base_prompt//\%\{[^\}]##\}} + post_prompt_nocolor=${post_prompt//\%\{[^\}]##\}} autoload -U add-zsh-hook add-zsh-hook precmd prompt_pygmalion_precmd } prompt_pygmalion_precmd(){ + setopt localoptions extendedglob + local gitinfo=$(git_prompt_info) - local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") + local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" local prompt_length=${#exp_nocolor} diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index 7a589a699..4e3238393 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -2,7 +2,7 @@ # # This theme needs a terminal supporting 256 colors as well as unicode. # In order to avoid external dependencies, it also has a zsh version of -# the perl script at https://github.com/trapd00r/utils/blob/master/zsh_path, +# the previously used perl script https://github.com/trapd00r/utils/blob/master/zsh_path, # which splits up the current path and makes it fancy. # # By default it spans over two lines like so: |