Skip to content

Commit

Permalink
[Fix sorin-ionescu#290] Add fish shell style PWD to sorin theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorin Ionescu committed Sep 25, 2012
1 parent 5993b17 commit af67111
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions modules/prompt/functions/prompt_sorin_setup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]? '
}
Expand Down

0 comments on commit af67111

Please sign in to comment.