1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 23:08:00 +00:00

[Fix #290] Add fish shell style PWD to sorin theme

This commit is contained in:
Sorin Ionescu 2012-09-25 00:54:49 -04:00
parent d7d85f517a
commit 52a8c98337

View File

@ -11,10 +11,24 @@
# Load dependencies. # Load dependencies.
pmodload 'helper' pmodload 'helper'
function prompt_sorin_pwd {
local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_sorin_pwd="$MATCH"
else
_prompt_sorin_pwd="${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}/${pwd:t}"
fi
}
function prompt_sorin_precmd { function prompt_sorin_precmd {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
# Format PWD.
prompt_sorin_pwd
# Get Git repository information.
if (( $+functions[git-info] )); then if (( $+functions[git-info] )); then
git-info git-info
fi fi
@ -53,7 +67,7 @@ function prompt_sorin_setup {
'rprompt' '%A%B%S%a%d%m%r%U%u' 'rprompt' '%A%B%S%a%d%m%r%U%u'
# Define prompts. # Define prompts.
PROMPT='%F{cyan}%1~%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' PROMPT='%F{cyan}${_prompt_sorin_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} '
RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_info[rprompt]}' RPROMPT='${editor_info[overwrite]}%(?:: %F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_info[rprompt]}'
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
} }