]> git.r.bdr.sh - rbdr/dotfiles/blame - prompt_ben_setup
Remove ruby prompt
[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
11 echo "(${venv})"
12}
13
14function box_name {
15 [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
16}
17
18function 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}
24zle -N zle-line-init
25zle -N zle-keymap-select
26
27function 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='
eb573503 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%}
a40a5ec5
BB
51%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ '
52}
53
54prompt_ben_setup "$@"
55
56#setopt PROMPT_SUBST
57
58ZSH_THEME_GIT_PROMPT_PREFIX="@%{%F{blue}%}"
59ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
60ZSH_THEME_GIT_PROMPT_DIRTY="%{%F{green}%}!"
61ZSH_THEME_GIT_PROMPT_UNTRACKED="%{%F{green}%}?"
62ZSH_THEME_GIT_PROMPT_CLEAN=""
63