mirror of
https://github.com/hcartiaux/dotfiles.git
synced 2024-10-18 09:15:24 +02:00
[zsh] git prompt file, shfmt run
This commit is contained in:
parent
535522dc91
commit
95e7bad149
1 changed files with 53 additions and 57 deletions
|
@ -23,7 +23,7 @@ prompt_hyacinthe_setup () {
|
|||
pcc[1]=${1:-${${SSH_CLIENT+'yellow'}:-'red'}}
|
||||
pcc[2]=${2:-'cyan'}
|
||||
|
||||
if [[ "$USERNAME" == "root" ]] ; then
|
||||
if [[ $USERNAME == "root" ]]; then
|
||||
pcc[3]=${3:-'red'}
|
||||
else
|
||||
pcc[3]=${3:-'green'}
|
||||
|
@ -41,7 +41,7 @@ prompt_hyacinthe_setup () {
|
|||
|
||||
p_date="$pc['\[']%F{$pcc[2]}%D{%R}$pc['\]']"
|
||||
|
||||
[[ -n "$WINDOW" ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']"
|
||||
[[ -n $WINDOW ]] && p_win="$pc['\(']%F{$pcc[4]}$WINDOW$pc['\)']"
|
||||
|
||||
p_userpwd="$pc['<']%F{$pcc[3]}%n@%m$p_win%F{$pcc[5]}:%F{$pcc[4]}%~$pc['>']"
|
||||
|
||||
|
@ -56,14 +56,13 @@ prompt_hyacinthe_setup () {
|
|||
add-zsh-hook chpwd update_git_vars
|
||||
}
|
||||
|
||||
update_current_git_vars()
|
||||
{
|
||||
update_current_git_vars() {
|
||||
unset __CURRENT_GIT_BRANCH
|
||||
unset __CURRENT_GIT_BRANCH_STATUS
|
||||
unset __CURRENT_GIT_BRANCH_IS_DIRTY
|
||||
|
||||
local st="$(git status 2>/dev/null)"
|
||||
if [[ -n "$st" ]]; then
|
||||
if [[ -n $st ]]; then
|
||||
local -a arr
|
||||
arr=(${(f)st})
|
||||
|
||||
|
@ -91,8 +90,7 @@ update_current_git_vars()
|
|||
fi
|
||||
}
|
||||
|
||||
prompt_git_info()
|
||||
{
|
||||
prompt_git_info() {
|
||||
if [ -n "$__CURRENT_GIT_BRANCH" ]; then
|
||||
local s="("
|
||||
case "$__CURRENT_GIT_BRANCH_STATUS" in
|
||||
|
@ -116,8 +114,7 @@ prompt_git_info()
|
|||
fi
|
||||
}
|
||||
|
||||
preexec_update_git_vars()
|
||||
{
|
||||
preexec_update_git_vars() {
|
||||
case "$1" in
|
||||
git*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
|
@ -134,4 +131,3 @@ update_git_vars() {
|
|||
}
|
||||
|
||||
prompt_hyacinthe_setup "$@"
|
||||
|
||||
|
|
Loading…
Reference in a new issue