From 7edeb29e588023691209bdaba61a042e25d6e95e Mon Sep 17 00:00:00 2001 From: pearofducks Date: Wed, 11 Apr 2012 15:55:36 +0200 Subject: [PATCH] Added quack theme --- README.md | 2 +- modules/prompt/functions/prompt_quack_setup | 40 +++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 modules/prompt/functions/prompt_quack_setup diff --git a/README.md b/README.md index 01fd7197..c9672182 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ accompanying README files to learn of what is available. 3. Load the theme you like in `~/.zshrc` then open a new Zsh terminal window or tab. ![sorin theme](http://i.imgur.com/aipDQ.png "sorin theme") - ![quack theme](http://imgur.com/vevSn "quack theme") + ![quack theme](http://i.imgur.com/vevSn.png "quack theme") ## Customization diff --git a/modules/prompt/functions/prompt_quack_setup b/modules/prompt/functions/prompt_quack_setup new file mode 100644 index 00000000..98b8c491 --- /dev/null +++ b/modules/prompt/functions/prompt_quack_setup @@ -0,0 +1,40 @@ +function prompt_quack_precmd { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + + function directory_list() { + if [[ $PWD = $HOME ]] + then + echo "%{$fg[green]%}~%{$reset_color%} ${return_code} " + else + echo "%{$fg_bold[green]%}${PWD%/*}/%{$reset_color%}%{$fg[green]%}${PWD##*/}%{$reset_color%} ${return_code} " + fi + } + + if (( $+functions[git-info] )); then + git-info + fi +} + +function prompt_quack_setup { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) + + autoload -Uz add-zsh-hook + add-zsh-hook precmd prompt_quack_precmd + + zstyle ':omz:module:editor' completing '%B%F{red}...%f%b' + zstyle ':omz:module:editor:keymap' primary '%B%F{yellow}$%f%b' + zstyle ':omz:module:editor:keymap' alternate '%F{yellow}#%f' + zstyle ':omz:module:git' branch '%%B%F{yellow}%b%f%%b' + zstyle ':omz:module:git' dirty ' %B%F{magenta}∆%f%b' + zstyle ':omz:module:git' clean ' %B%F{magenta}•%f%b' + zstyle ':omz:module:git' info \ + 'prompt' '%b%D%C ' + PROMPT='${(e)git_info[prompt]}${editor_info[keymap]} ' + PROMPT2='%F{red}%f\ %{$reset_color%}' + RPS1='$(directory_list)' +} + +prompt_quack_setup "$@"