forked from sorin-ionescu/prezto
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# | ||
# A colourful, friendly, multiline theme with some handy features: | ||
# | ||
# * Simple VCS branch, staged, and unstaged indication. | ||
# * Prompt character is different in a VCS repository. | ||
# * Last command exit status is displayed clearly if it was non-zero. | ||
# | ||
# This theme is particularly well-suited to the pastel colours used by KDE's | ||
# Konsole terminal emulator. | ||
# | ||
# Authors: | ||
# Paul Gideon Dann <pdgiddie@gmail.com> | ||
# | ||
|
||
# TODO: Currently only tailored to git. | ||
|
||
function prompt_giddie_precmd { | ||
vcs_info | ||
|
||
# Replace "/home/<user>" with "~" | ||
prompt_custom_wd=${PWD/$HOME\//\~/} | ||
|
||
# Choose prompt symbol based on whether on not we're in a repository. | ||
{ git branch 2>&1 } >/dev/null | ||
if [[ $? == 0 ]]; then | ||
prompt_symbol='±' | ||
else | ||
prompt_symbol=')' | ||
fi | ||
|
||
# This will be displayed additionally if the last exit status was non-zero. | ||
prompt_exit_status="%F{red}%B-> [%?]%b%f" | ||
} | ||
|
||
function prompt_giddie_setup { | ||
autoload -Uz vcs_info | ||
autoload -Uz add-zsh-hook | ||
add-zsh-hook precmd prompt_giddie_precmd | ||
|
||
prompt_opts=(cr percent subst) | ||
|
||
zstyle ':omz:prompt' vicmd '%F{yellow}--- VI-COMMAND ---%f' | ||
zstyle ':vcs_info:*' enable git | ||
zstyle ':vcs_info:*' check-for-changes true | ||
zstyle ':vcs_info:*' formats ' on %F{magenta}%b%f%c%u' | ||
zstyle ':vcs_info:*' actionformats ' on %F{magenta}%b%f%c%u %F{yellow}(%a)%f' | ||
zstyle ':vcs_info:*' stagedstr '%F{green}+%f' | ||
zstyle ':vcs_info:*' unstagedstr '%F{green}!%f' | ||
|
||
PROMPT='%(?..${prompt_exit_status} | ||
)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${prompt_custom_wd}%f${vcs_info_msg_0_} | ||
%F{blue}${prompt_symbol}%f ' | ||
RPROMPT= | ||
SPROMPT='%F{blue}zsh: %F{yellow}correct %F{magenta}%R%f to %F{green}%r%f [nyae]? ' | ||
} | ||
|
||
prompt_giddie_setup "$@" | ||
|
||
# vim: ft=zsh |