diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2016-11-06 02:44:21 +0100 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2017-06-01 18:37:35 +0200 |
commit | 9188fba3b14c331744b8593138f9496adea4ea60 (patch) | |
tree | 2c7ab948dab8a538ddccbd35c86ffde407ded2a7 /zsh/themes/prompt_kyrias_setup | |
parent | b8934837f867f14d219b3360ce5407aae9dd005e (diff) | |
download | dotfiles-9188fba3b14c331744b8593138f9496adea4ea60.tar.xz |
zsh: Use the ZSH prompt system for prompt
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to 'zsh/themes/prompt_kyrias_setup')
-rw-r--r-- | zsh/themes/prompt_kyrias_setup | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/zsh/themes/prompt_kyrias_setup b/zsh/themes/prompt_kyrias_setup new file mode 100644 index 0000000..68dbfd8 --- /dev/null +++ b/zsh/themes/prompt_kyrias_setup @@ -0,0 +1,39 @@ +prompt_kyrias_help() { + cat <<EOF +kyrias' prompt. +EOF +} + +prompt_user_color() { + if (( ! UID )); then + print "red" + else + print "black" + fi +} + +venv_prompt() { + if [[ -n "$VIRTUAL_ENV" ]]; then + print -P '%{$bg[blue]$fg[white] ${VIRTUAL_ENV##*/} %f%k%}' + fi +} + +prompt_kyrias_precmd() { + print -Pn "\e];%n %~\a" +} + +prompt_kyrias_setup() { + setopt prompt_subst + autoload -U colors && colors + + PROMPT='%{$bg[$(prompt_user_color)]$fg[white] %m %k%f$bg[white]$fg[$(prompt_user_color)] %~ %f%k$(venv_prompt) +$bg[blue]%} λ %k %}' +} + +prompt_kyrias_preview() { + prompt_preview_theme kyrias "$@" +} + +prompt_kyrias_setup "$@" + +# vim: ft=zsh |