Last active
December 7, 2015 08:52
-
-
Save eerohele/1e102ac415629498cd92 to your computer and use it in GitHub Desktop.
my zprezto prompt
This file contains hidden or 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
function prompt_lambda_precmd { | |
setopt LOCAL_OPTIONS | |
unsetopt XTRACE KSH_ARRAYS | |
prompt_lambda_pwd | |
# Get Git repository information. | |
if (( $+functions[git-info] )); then | |
git-info | |
fi | |
} | |
function prompt_lambda_pwd { | |
local pwd="${PWD/#$HOME/~}" | |
if [[ "$pwd" == (#m)[/~] ]]; then | |
_prompt_lambda_pwd="$MATCH" | |
unset MATCH | |
else | |
_prompt_lambda_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}" | |
fi | |
} | |
function prompt_lambda_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 vcs_info before each command. | |
add-zsh-hook precmd prompt_lambda_precmd | |
# Set git-info parameters. | |
zstyle ':prezto:module:git:info' verbose 'yes' | |
zstyle ':prezto:module:git:info:dirty' format "%F{red}●%f" | |
zstyle ':prezto:module:git:info:clean' format "%B%F{$secondary_color}]%f%b" | |
zstyle ':prezto:module:git:info:branch' format "%f%%b%%B%F{$primary_color}%b%f%%b" | |
zstyle ':prezto:module:git:info:keys' format 'rprompt' '%D %b' | |
# Define prompts. | |
PROMPT='${_prompt_lambda_pwd} %(?.%F{white}.%F{red})λ%f : ' | |
RPROMPT='${git_info:+${(e)git_info[rprompt]}}' | |
} | |
prompt_lambda_setup "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment