]> git.r.bdr.sh - rbdr/dotfiles/blame - prompt_ben_setup
Remove vim submodule
[rbdr/dotfiles] / prompt_ben_setup
CommitLineData
a40a5ec5
BB
1function prompt_ben_precmd {
2 git-info
3}
4
a40a5ec5
BB
5function virtualenv_info {
6 if [[ -z "$VIRTUAL_ENV" ]]; then
7 venv="default"
8 else
9 venv="${VIRTUAL_ENV##*/}"
10 fi
01e20652
BB
11 echo "🐍${venv}"
12}
13
14function rvm_info {
15 if [[ -z "$RUBY_VERSION" ]]; then
16 rvminfo="default"
17 else
18 rvminfo=`rvm-prompt`
19 fi
20 echo "💎${rvminfo}"
21}
22
23function nvm_info {
24 if [[ -z "$NVM_BIN" ]]; then
25 nvminfo="default"
26 else
27 nvminfo=`nvm current`
28 fi
29 echo "💛${nvminfo}"
a40a5ec5
BB
30}
31
32function box_name {
33 [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
34}
35
36function zle-line-init zle-keymap-select {
37 local return_status="%{%F{red}%}%(?..✘)%{$reset_color%}"
38 RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}${return_status}%{$reset_color%}"
39 RPS2=$RPS1
40 zle reset-prompt
41}
42zle -N zle-line-init
43zle -N zle-keymap-select
44
45function prompt_ben_setup {
46 setopt LOCAL_OPTIONS
47 unsetopt XTRACE KSH_ARRAYS
48 prompt_opts=(cr percent subst)
49
50 # Load required functions.
51 autoload -Uz add-zsh-hook
52
53 # Add hook for calling git-info before each command.
54 add-zsh-hook precmd prompt_ben_precmd
55
56 # Set git-info parameters.
57 zstyle ':prezto:module:git:info' verbose 'yes'
e8cfa78c 58 zstyle ':prezto:module:git:info:branch' format '@%F{cyan}%b%f'
a40a5ec5
BB
59 zstyle ':prezto:module:git:info:clean' format ''
60 zstyle ':prezto:module:git:info:added' format '%{%F{green}%}!'
61 zstyle ':prezto:module:git:info:modified' format '%{%F{green}%}?'
e8cfa78c 62 zstyle ':prezto:module:git:info:untracked' format '%{%F{magenta}%}?'
a40a5ec5
BB
63 zstyle ':prezto:module:git:info:keys' format \
64 'prompt' '%b%a%m%u'
65
66 # Define prompts.
67 PROMPT='
01e20652 68%{%F{black}%}$(nvm_info) $(rvm_info) $(virtualenv_info)
e8cfa78c 69%{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(box_name)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}${git_info[prompt]} %{%f%}
a40a5ec5
BB
70%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ '
71}
72
73prompt_ben_setup "$@"
74
75#setopt PROMPT_SUBST
76
e8cfa78c 77ZSH_THEME_GIT_PROMPT_PREFIX="@%{%F{cyan}%}"
a40a5ec5
BB
78ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
79ZSH_THEME_GIT_PROMPT_DIRTY="%{%F{green}%}!"
80ZSH_THEME_GIT_PROMPT_UNTRACKED="%{%F{green}%}?"
81ZSH_THEME_GIT_PROMPT_CLEAN=""
82