Last active
September 5, 2017 14:10
-
-
Save afdalwahyu/7db44afbc0b385648a495efccf1f3783 to your computer and use it in GitHub Desktop.
if you're using conda, set config changeps1 to false -> conda config --set changeps1 false
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:ft=zsh ts=2 sw=2 sts=2 | |
if [[ $EUID -eq 0 ]]; then | |
_USERNAME="%{$fg_bold[red]%}%n" | |
_LIBERTY="%{$fg[red]%}#" | |
else | |
_USERNAME="%{$fg_bold[white]%}%n" | |
_LIBERTY="%{$fg[green]%}$" | |
fi | |
_USERNAME="$_USERNAME%{$reset_color%}@%m" | |
_LIBERTY="$_LIBERTY%{$reset_color%}" | |
_fishy_collapsed_wd() { | |
if [[ $(pwd) != $HOME ]]; then | |
echo $(pwd | sed 's,/*[^/]\+/*$,,' | perl -pe ' | |
BEGIN { | |
binmode STDIN, ":encoding(UTF-8)"; | |
binmode STDOUT, ":encoding(UTF-8)"; | |
}; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g | |
')/ | |
fi | |
} | |
# conda config --set changeps1 false | |
function virtualenv_info { | |
[ $CONDA_DEFAULT_ENV ] && echo '('`basename $CONDA_DEFAULT_ENV`') ' | |
} | |
PROMPT=' | |
$_USERNAME %{$fg_bold[blue]%}$(_fishy_collapsed_wd)%1~%{$reset_color%}$(git_prompt_info) | |
$(virtualenv_info)> $_LIBERTY ' | |
ZSH_THEME_GIT_PROMPT_PREFIX="::%{$fg[magenta]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment