mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Revised suvash theme
- minimal prompt - pythonbrew/venv support - smart right prompt
This commit is contained in:
parent
25a9cddc21
commit
7de6836ed1
1 changed files with 45 additions and 14 deletions
|
|
@ -4,27 +4,58 @@ function prompt_char {
|
|||
echo '○'
|
||||
}
|
||||
|
||||
function virtualenv_info {
|
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||
}
|
||||
|
||||
function collapse_pwd {
|
||||
echo $(pwd | sed -e "s,^$HOME,~,")
|
||||
}
|
||||
|
||||
function prompt_rvm_ruby {
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
|
||||
$(virtualenv_info)$(prompt_char) '
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}
|
||||
$(virtualenv_info)$(prompt_char) '
|
||||
echo $(rvm-prompt i v g)
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_python_version {
|
||||
if which python &> /dev/null; then
|
||||
echo 'python-'`python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))'`
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_pythonbrew_python {
|
||||
if which pythonbrew &> /dev/null; then
|
||||
if [ $VIRTUAL_ENV ]; then
|
||||
echo $(prompt_python_version)'#'`basename $VIRTUAL_ENV`
|
||||
else
|
||||
echo $(prompt_python_version)
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function prompt_right_dynamic_length {
|
||||
if [ "${COLUMNS}" -gt "160" ]; then
|
||||
echo "%{$fg[red]%}$(prompt_rvm_ruby)%{$reset_color%} ‹ %{$fg[red]%}$(prompt_pythonbrew_python)%{$reset_color%}"
|
||||
elif [ "${COLUMNS}" -gt "80" ]; then
|
||||
echo "%{$fg[red]%}$(prompt_rvm_ruby)%{$reset_color%}"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" › %{$fg[yellow]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}⚐%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}⚈%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚆%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%}⚒%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}⚛%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}☢%{$reset_color%}"
|
||||
|
||||
|
||||
PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[blue]%}@%{$reset_color%}%{$fg[magenta]%}%m%{$reset_color%} › %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}
|
||||
$(prompt_char) '
|
||||
|
||||
RPROMPT='$(prompt_right_dynamic_length)'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue