Unverified Commit 0c1a5877 authored by Midgard's avatar Midgard

[zsh theme] Clean up code

parent 7a5304fa
......@@ -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=""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment