zsh prompt uses color for git status
This commit is contained in:
parent
f6de79b9b9
commit
74b45c9520
1 changed files with 23 additions and 10 deletions
33
.zshrc
33
.zshrc
|
|
@ -1,9 +1,16 @@
|
||||||
|
typeset -ga preexec_functions
|
||||||
|
typeset -ga precmd_functions
|
||||||
|
typeset -ga chpwd_functions
|
||||||
|
fpath=($fpath $HOME/.zsh/func)
|
||||||
|
typeset -u fpath
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
setopt appendhistory hist_ignore_space hist_ignore_all_dups extendedglob nomatch notify dvorak # correct
|
setopt appendhistory hist_ignore_space hist_ignore_all_dups extendedglob nomatch notify dvorak # correct
|
||||||
unsetopt beep
|
unsetopt beep
|
||||||
bindkey -e
|
bindkey -e
|
||||||
|
|
||||||
zstyle :compinstall filename '~/.zshrc'
|
zstyle :compinstall filename '~/.zshrc'
|
||||||
autoload -Uz compinit colors && colors
|
autoload -Uz compinit colors zgitinit && colors && zgitinit
|
||||||
compinit -u
|
compinit -u
|
||||||
#bindkey '^L' push-line
|
#bindkey '^L' push-line
|
||||||
bindkey "^I" expand-or-complete-prefix
|
bindkey "^I" expand-or-complete-prefix
|
||||||
|
|
@ -69,16 +76,22 @@ HISTSIZE=1000
|
||||||
SAVEHIST=1000
|
SAVEHIST=1000
|
||||||
HISTFILE=~/.history
|
HISTFILE=~/.history
|
||||||
export GPGKEY="48C7AF0C"
|
export GPGKEY="48C7AF0C"
|
||||||
if [ -x `which git` ] ; then
|
|
||||||
GIT_STATUS="git status|grep 'Changed but not updated:' > /dev/null"
|
# Prompt
|
||||||
GIT_STAGED="git status|grep 'Changes to be committed:' > /dev/null"
|
|
||||||
fi
|
|
||||||
#PS1="%m%# "
|
#PS1="%m%# "
|
||||||
return_red="%(?..$fg[red])"
|
prompt_precmd() {
|
||||||
git_unstaged_green="%($GIT..$fg[green])"
|
if ! zgit_isindexclean ; then
|
||||||
git_staged_yellow="%(?..$fg[yellow])"
|
#PROMPT="[%F{$usercolor}%n%F{white}@%F{$hostcolor}%m%F{white}:%F{blue}%~%f](%F{cyan}$(zgit_branch)%f)>"
|
||||||
PS1="%m$git_changed_green$git_staged_yellow$return_red%#%{$reset_color%} "
|
gitcolor=$fg[blue]
|
||||||
#PS1=${FACE[$[($?)?1:0]]}
|
elif ! zgit_isworktreeclean ; then
|
||||||
|
#PROMPT="[%F{$usercolor}%n%F{white}@%F{$hostcolor}%m%F{white}:%F{blue}%~%f]>"
|
||||||
|
gitcolor=$fg[green]
|
||||||
|
fi
|
||||||
|
color="%(?.$gitcolor.$fg[red])"
|
||||||
|
PROMPT="%m$color%#%{$reset_color%} "
|
||||||
|
}
|
||||||
|
precmd_functions+=prompt_precmd
|
||||||
|
|
||||||
export LANG="en_US.UTF-8"
|
export LANG="en_US.UTF-8"
|
||||||
#export LC_CTYPE="en_US.UTF-8"
|
#export LC_CTYPE="en_US.UTF-8"
|
||||||
export LC_COLLATE="C" #order files in ls
|
export LC_COLLATE="C" #order files in ls
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue