diff options
author | David Runge <david.runge@frqrec.com> | 2014-10-31 18:30:03 +0100 |
---|---|---|
committer | David Runge <david.runge@frqrec.com> | 2014-10-31 18:30:03 +0100 |
commit | ccf94b7df09799feb201d1a59928932fda4e24f4 (patch) | |
tree | 32a8352121f29c02ac3e3024deaae338c5fc04a3 /.zsh.prompts/prompt_kylewest_setup | |
parent | ca44a29e2ebd7c2fc80899139335ee1547867ea6 (diff) | |
download | dotfiles-ccf94b7df09799feb201d1a59928932fda4e24f4.tar.gz dotfiles-ccf94b7df09799feb201d1a59928932fda4e24f4.tar.bz2 dotfiles-ccf94b7df09799feb201d1a59928932fda4e24f4.tar.xz dotfiles-ccf94b7df09799feb201d1a59928932fda4e24f4.zip |
zsh: Adding config files for zprezto, zsh settings and prompts, to comply with the way zprezto gets started
Diffstat (limited to '.zsh.prompts/prompt_kylewest_setup')
-rw-r--r-- | .zsh.prompts/prompt_kylewest_setup | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/.zsh.prompts/prompt_kylewest_setup b/.zsh.prompts/prompt_kylewest_setup new file mode 100644 index 0000000..c67b5e4 --- /dev/null +++ b/.zsh.prompts/prompt_kylewest_setup @@ -0,0 +1,57 @@ +# +# A theme based on sorin theme +# * ruby info shown on the right +# * git info on the left +# * editor mode as $> or <# +# * single line prompt +# +# Authors: +# Sorin Ionescu <sorin.ionescu@gmail.com> +# Kyle West <kswest@gmail.com> + +function prompt_kylewest_precmd { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + + # Get Git repository information. + if (( $+functions[git-info] )); then + git-info on + git-info + fi + + # Get ruby information + if (( $+functions[ruby-info] )); then + ruby-info + fi +} + +function prompt_kylewest_setup { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) + + # Load required functions. + autoload -Uz add-zsh-hook + + # Add hook for calling git-info before each command. + add-zsh-hook precmd prompt_kylewest_precmd + + # editor + zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' + zstyle ':prezto:module:editor:info:keymap:primary' format "%B%F{green}$>%f%b" + zstyle ':prezto:module:editor:info:keymap:alternate' format "%B%F{magenta}<#%f%b" + + # ruby info (rvm, rbenv) + zstyle ':prezto:module:ruby:info:version' format '[ %v ]' + + # vcs + zstyle ':prezto:module:git:info:branch' format '%F{yellow}%b%f' + zstyle ':prezto:module:git:info:dirty' format '%B%F{red}!%f%b' + zstyle ':prezto:module:git:info:keys' format 'prompt' '- %b%D ' + + # prompts + PROMPT='%F{cyan}%c%f ${git_info[prompt]}${editor_info[keymap]} ' + RPROMPT='%F{blue}${ruby_info[version]}' +} + +prompt_kylewest_setup "$@" |