[zsh theme] Clean up code
This commit is contained in:
parent
7a5304fab1
commit
0c1a5877c1
1 changed files with 7 additions and 5 deletions
|
@ -2,24 +2,26 @@
|
|||
|
||||
function my_pwd {
|
||||
# ~ for home; keep only the last two directories
|
||||
echo $(echo "$PWD" | sed -r '
|
||||
echo "$PWD" | sed -r '
|
||||
s,^'"$HOME"',~,; t reset; :reset
|
||||
s|^~/git/my-cool-project/([^/])[^/]+/([^/]+)/|\1/\2/|; t end
|
||||
s|^.+/([^/]*/[^/]*)$|\1|
|
||||
:end')
|
||||
:end'
|
||||
}
|
||||
|
||||
function my_retval {
|
||||
RETVAL=$?
|
||||
|
||||
if [[ $RETVAL -eq 0 ]]; then
|
||||
echo "%{$fg[yellow]%}"
|
||||
echo "%{%F{yellow}%}"
|
||||
else
|
||||
echo "%{$fg[red]%}$RETVAL "
|
||||
echo "%{%F{red}%}$RETVAL "
|
||||
fi
|
||||
}
|
||||
|
||||
PROMPT='$(my_retval)$(my_pwd)$(git_prompt_info)$(git_prompt_status) %{$reset_color%} '
|
||||
function precmd {
|
||||
PS1="$(my_retval)$(my_pwd)$(git_prompt_info)$(git_prompt_status) %{%f%} "
|
||||
}
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%} "
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
|
|
Loading…
Reference in a new issue