mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 16:59:03 +01:00
feat(git-prompt): show deleted files (#11245)
This commit is contained in:
parent
62929263fa
commit
fb66b67d68
@ -47,6 +47,7 @@ function update_current_git_vars() {
|
||||
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
|
||||
GIT_STASHED=$__CURRENT_GIT_STATUS[8]
|
||||
GIT_CLEAN=$__CURRENT_GIT_STATUS[9]
|
||||
GIT_DELETED=$__CURRENT_GIT_STATUS[10]
|
||||
}
|
||||
|
||||
git_super_status() {
|
||||
@ -69,6 +70,9 @@ git_super_status() {
|
||||
if [ "$GIT_CHANGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_DELETED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_DELETED$GIT_DELETED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_UNTRACKED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED$GIT_UNTRACKED%{${reset_color}%}"
|
||||
fi
|
||||
@ -91,6 +95,7 @@ ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[blue]%}%{-%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%}%{…%G%}"
|
||||
|
@ -44,7 +44,7 @@ if po.returncode != 0:
|
||||
sys.exit(0) # Not a git repository
|
||||
|
||||
# collect git status information
|
||||
untracked, staged, changed, conflicts = [], [], [], []
|
||||
untracked, staged, changed, deleted, conflicts = [], [], [], [], []
|
||||
ahead, behind = 0, 0
|
||||
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
|
||||
for st in status:
|
||||
@ -75,13 +75,15 @@ for st in status:
|
||||
else:
|
||||
if st[1] == 'M':
|
||||
changed.append(st)
|
||||
if st[1] == 'D':
|
||||
deleted.append(st)
|
||||
if st[0] == 'U':
|
||||
conflicts.append(st)
|
||||
elif st[0] != ' ':
|
||||
staged.append(st)
|
||||
|
||||
stashed = get_stash()
|
||||
if not changed and not staged and not conflicts and not untracked:
|
||||
if not changed and not deleted and not staged and not conflicts and not untracked:
|
||||
clean = 1
|
||||
else:
|
||||
clean = 0
|
||||
@ -95,6 +97,7 @@ out = ' '.join([
|
||||
str(len(changed)),
|
||||
str(len(untracked)),
|
||||
str(stashed),
|
||||
str(clean)
|
||||
str(clean),
|
||||
str(len(deleted))
|
||||
])
|
||||
print(out, end='')
|
||||
|
Loading…
Reference in New Issue
Block a user