[Fix #290] Add fish shell style PWD to sorin theme
This commit is contained in:
parent
d7d85f517a
commit
52a8c98337
|
@ -11,10 +11,24 @@
|
|||
# Load dependencies.
|
||||
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 {
|
||||
setopt LOCAL_OPTIONS
|
||||
unsetopt XTRACE KSH_ARRAYS
|
||||
|
||||
# Format PWD.
|
||||
prompt_sorin_pwd
|
||||
|
||||
# Get Git repository information.
|
||||
if (( $+functions[git-info] )); then
|
||||
git-info
|
||||
fi
|
||||
|
@ -49,11 +63,11 @@ function prompt_sorin_setup {
|
|||
zstyle ':prezto:module:git' unmerged ' %%B%F{yellow}═%f%%b'
|
||||
zstyle ':prezto:module:git' untracked ' %%B%F{white}◼%f%%b'
|
||||
zstyle ':prezto:module:git' info \
|
||||
'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \
|
||||
'prompt' ' %F{blue}git%f$(coalesce "%b" "%p" "%c")%s' \
|
||||
'rprompt' '%A%B%S%a%d%m%r%U%u'
|
||||
|
||||
# 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]}'
|
||||
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue