no atomaka reference (git info still broekn)

This commit is contained in:
Andrew Tomaka 2015-12-10 14:45:06 -05:00
parent 48c0739427
commit 29dddbf605

View file

@ -1,15 +1,15 @@
function prompt_atomaka_pwd { function prompt_pwd {
local pwd="${PWD/#$HOME/~}" local pwd="${PWD/#$HOME/~}"
if [[ "$pwd" == (#m)[/~] ]]; then if [[ "$pwd" == (#m)[/~] ]]; then
_prompt_atomaka_pwd="$MATCH" _prompt_pwd="$MATCH"
unset MATCH unset MATCH
else else
_prompt_atomaka_pwd="${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}/${pwd:t}" _prompt_pwd="${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}/${pwd:t}"
fi fi
} }
function prompt_atomaka_userhost { function prompt_userhost {
eval PR_USER='%F{green}%n%f' eval PR_USER='%F{green}%n%f'
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='%F{yellow}%M%f' #SSH eval PR_HOST='%F{yellow}%M%f' #SSH
@ -17,20 +17,20 @@ function prompt_atomaka_userhost {
eval PR_HOST='%F{green}%M%f' # no SSH eval PR_HOST='%F{green}%M%f' # no SSH
fi fi
_prompt_atomaka_userhost="${PR_USER}%F{cyan}@${PR_HOST}%f" _prompt_userhost="${PR_USER}%F{cyan}@${PR_HOST}%f"
} }
function prompt_atomaka_ruby { function prompt_ruby {
if which rvm-prompt &> /dev/null; then if which rvm-prompt &> /dev/null; then
_prompt_atomaka_ruby="[%F{red}$(rvm-prompt i v g s)%f]" _prompt_ruby="[%F{red}$(rvm-prompt i v g s)%f]"
else else
if which rbenv &> /dev/null; then if which rbenv &> /dev/null; then
_prompt_atomaka_ruby="[%F{red}$(rbenv version | sed -e "s/ (set.*$//")%f]" _prompt_ruby="[%F{red}$(rbenv version | sed -e "s/ (set.*$//")%f]"
fi fi
fi fi
} }
function prompt_atomaka_vcs { function prompt_vcs {
local branch_format="(%F{yellow}%b%f%u%c)" local branch_format="(%F{yellow}%b%f%u%c)"
local action_format="(%F{yellow}%a%f)" local action_format="(%F{yellow}%a%f)"
local unstaged_format="%F{green}*%f" local unstaged_format="%F{green}*%f"
@ -44,16 +44,16 @@ function prompt_atomaka_vcs {
zstyle ':vcs_info:*:prompt:*' formats "${branch_format}" zstyle ':vcs_info:*:prompt:*' formats "${branch_format}"
zstyle ':vcs_info:*:prompt:*' nvcsformats "" zstyle ':vcs_info:*:prompt:*' nvcsformats ""
_prompt_atomaka_vcs="${vcs_info_msg_0_}" _prompt_vcs="${vcs_info_msg_0_}"
} }
function prompt_atomaka_precmd { function prompt_precmd {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
setopt prompt_subst setopt prompt_subst
# Format PWD. # Format PWD.
prompt_atomaka_pwd prompt_pwd
# vcs prompt # vcs prompt
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
@ -67,7 +67,7 @@ function prompt_atomaka_precmd {
vcs_info 'prompt' vcs_info 'prompt'
} }
function prompt_atomaka_setup { function prompt_setup {
setopt LOCAL_OPTIONS setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst) prompt_opts=(cr percent subst)
@ -77,26 +77,28 @@ function prompt_atomaka_setup {
autoload -Uz vcs_info autoload -Uz vcs_info
# Add hook for calling git-info before each command. # Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_atomaka_precmd add-zsh-hook precmd prompt_precmd
# keep this # keep this
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
# custom stuff # custom stuff
prompt_atomaka_ruby prompt_ruby
prompt_atomaka_userhost prompt_userhost
prompt_atomaka_vcs prompt_vcs
local current_time="[%B%D{%I:%M:%S}%b]" local current_time="[%B%D{%I:%M:%S}%b]"
local current_dir='%B%F{blue}%~%f%b' local current_dir='%B%F{blue}%~%f%b'
local return_code="%(?..%?)" local return_code="%(?..%?)"
local user_host=$_prompt_atomaka_userhost local user_host=$_prompt_userhost
local ruby_info=$_prompt_atomaka_ruby local ruby_info=$_prompt_ruby
local git_info=$_prompt_atomaka_vcs local git_info=$_prompt_vcs
local PR_PROMPT="%(?.%F{green}->.%F{red}-%B${return_code}%b%F{red}->%{%})%f" local PR_PROMPT="%(?.%F{green}->.%F{red}-%B${return_code}%b%F{red}->%{%})%f"
PROMPT="${current_time} ${user_host} ${current_dir} ${ruby_info} ${git_info} PROMPT="${current_time} ${user_host} ${current_dir} ${ruby_info} ${git_info}
|$PR_PROMPT " |$PR_PROMPT "
} }
prompt_atomaka_setup "$@" precmd () { vcs_info }
prompt_setup "$@"