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