2013-07-11 18:19:54 +00:00
|
|
|
#
|
|
|
|
# A simple theme inspired by the Sorin and PeepCode themes.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Daniel Møller Kristensen <damoekri@icloud.com>
|
|
|
|
#
|
|
|
|
# Screenshots:
|
|
|
|
# http://i.imgur.com/AX9HnPF.png
|
|
|
|
#
|
|
|
|
|
|
|
|
# Load dependencies.
|
|
|
|
pmodload 'helper'
|
|
|
|
|
2015-09-29 15:42:55 +00:00
|
|
|
prompt_damoekri_precmd() {
|
2013-07-11 18:19:54 +00:00
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
|
|
|
|
|
|
|
# Format PWD.
|
2017-07-21 00:08:19 +00:00
|
|
|
_prompt_damoekri_pwd=$(prompt-pwd)
|
2013-07-11 18:19:54 +00:00
|
|
|
|
|
|
|
# Get Git repository information.
|
|
|
|
if (( $+functions[git-info] )); then
|
|
|
|
git-info
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get Ruby version information.
|
|
|
|
if (( $+functions[ruby-info] )); then
|
|
|
|
ruby-info
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function prompt_damoekri_setup {
|
|
|
|
setopt LOCAL_OPTIONS
|
|
|
|
unsetopt XTRACE KSH_ARRAYS
|
2017-08-10 18:23:26 +00:00
|
|
|
prompt_opts=(cr percent sp subst)
|
2013-07-11 18:19:54 +00:00
|
|
|
|
|
|
|
# Load required functions.
|
|
|
|
autoload -Uz add-zsh-hook
|
|
|
|
|
|
|
|
# Add hook for calling git-info and ruby-info before each command.
|
|
|
|
add-zsh-hook precmd prompt_damoekri_precmd
|
|
|
|
|
2019-07-25 22:14:43 +00:00
|
|
|
# Tell prezto we can manage this prompt
|
|
|
|
zstyle ':prezto:module:prompt' managed 'yes'
|
|
|
|
|
2013-07-11 18:19:54 +00:00
|
|
|
# Set editor-info parameters.
|
|
|
|
zstyle ':prezto:module:editor:info:keymap:primary' format ' %F{green}»%f'
|
|
|
|
|
|
|
|
# Set git-info parameters.
|
|
|
|
zstyle ':prezto:module:git:info' verbose 'yes'
|
|
|
|
zstyle ':prezto:module:git:info:action' format ':%F{magenta}%s%f'
|
|
|
|
zstyle ':prezto:module:git:info:branch' format '%F{blue}%b%f'
|
|
|
|
zstyle ':prezto:module:git:info:clean' format ' %F{green}✔%f'
|
|
|
|
zstyle ':prezto:module:git:info:dirty' format ' %F{red}✗%f'
|
|
|
|
zstyle ':prezto:module:git:info:commit' format '%F{blue}%.7c%f'
|
|
|
|
zstyle ':prezto:module:git:info:position' format '%F{blue}%p%f'
|
|
|
|
zstyle ':prezto:module:git:info:keys' format \
|
|
|
|
'rprompt' ' $(coalesce "%b" "%p" "%c")%s%C%D'
|
|
|
|
|
|
|
|
# Set ruby-info parameters.
|
|
|
|
zstyle ':prezto:module:ruby:info:version' format ' %F{yellow}%v%f'
|
|
|
|
|
|
|
|
# Define prompts.
|
|
|
|
PROMPT='%F{cyan}${_prompt_damoekri_pwd}%f${editor_info[keymap]} '
|
|
|
|
RPROMPT='${git_info:+${(e)git_info[rprompt]}}${ruby_info:+${ruby_info[version]}}'
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt_damoekri_setup "$@"
|
2019-07-25 22:14:43 +00:00
|
|
|
# vim: ft=zsh
|