-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprompt_damoekri_setup
76 lines (61 loc) · 2.02 KB
/
prompt_damoekri_setup
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# A simple theme inspired by the Sorin and PeepCode themes.
#
# Authors:
# Daniel Møller Kristensen <[email protected]>
#
# Screenshots:
# http://i.imgur.com/AX9HnPF.png
#
# Load dependencies.
pmodload 'helper'
function prompt_damoekri_pwd {
local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_damoekri_pwd="[$MATCH]"
unset MATCH
else
_prompt_damoekri_pwd="[${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}]"
fi
}
function prompt_damoekri_precmd {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
# Format PWD.
prompt_damoekri_pwd
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
fi
# Get node version information.
if (( $+functions[node-info] )); then
node-info
fi
}
function prompt_damoekri_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 and ruby-info before each command.
add-zsh-hook precmd prompt_damoekri_precmd
# Set editor-info parameters.
zstyle ':prezto:module:editor:info:keymap:primary' format '%F{green}$%f'
# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:action' format ':%F{magenta}%s%f'
zstyle ':prezto:module:git:info:branch' format '%F{blue}%b%f'
zstyle ':prezto:module:git:info:clean' format ' %F{green}✔%f'
zstyle ':prezto:module:git:info:dirty' format ' %F{red}X%f'
zstyle ':prezto:module:git:info:commit' format '%F{blue}%.7c%f'
zstyle ':prezto:module:git:info:position' format '%F{blue}%p%f'
zstyle ':prezto:module:git:info:keys' format \
'rprompt' ' $(coalesce "%b" "%p" "%c")%s%C%D'
# %v - Node.js version.
zstyle ':prezto:module:node:info:version' format '%F{yellow} %v'
# Define prompts.
PROMPT='%F{cyan}${_prompt_damoekri_pwd}%f${editor_info[keymap]} '
RPROMPT='${git_info:+${(e)git_info[rprompt]}} ${node_info:+${node_info[version]}}'
}
prompt_damoekri_setup "$@"