forked from sorin-ionescu/prezto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprompt_rcreasey_setup
More file actions
59 lines (45 loc) · 1.61 KB
/
Copy pathprompt_rcreasey_setup
File metadata and controls
59 lines (45 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Load dependencies.
pmodload 'helper'
function prompt_rcreasey_pwd {
local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_rcreasey_pwd="$MATCH"
unset MATCH
else
_prompt_rcreasey_pwd="${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}/${pwd:t}"
fi
}
function prompt_rcreasey_precmd {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
# Format PWD.
prompt_rcreasey_pwd
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
fi
}
function prompt_rcreasey_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 git-info before each command.
add-zsh-hook precmd prompt_rcreasey_precmd
# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{105}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{105}»%f%b'
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}♺%f'
# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:branch' format ':%F{075}%b%f'
zstyle ':prezto:module:git:info:dirty' format '%%B%F{214}*%f%%b'
zstyle ':prezto:module:git:info:keys' format 'prompt' '%F{075}(branch$(coalesce "%b" "%p" "%c")%s%D%F{075})'
# Define prompts.
#
PROMPT='%F{032}${_prompt_rcreasey_pwd}%f${git_info:+${(e)git_info[prompt]}}%(!. %B%F{red}#%f%b.)${editor_info[keymap]} '
RPROMPT='%B%F{237}%n@%m%f%b'
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
}
prompt_rcreasey_setup "$@"