Skip to content

Commit bc2df38

Browse files
committed
Fix the git status line.
1 parent 0bfa408 commit bc2df38

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

config/zsh-custom/themes/custom.zsh-theme

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,33 @@
33

44
local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})"
55

6-
function get_git_branch {
7-
echo $(git rev-parse --abbrev-ref HEAD 2> /dev/null);
8-
# echo $(git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})
9-
}
10-
11-
function get_git_remote {
12-
# echo $(git remote)
13-
echo $(git config --get branch.$branch.remote)
6+
my_host() {
7+
if [[ -n "$SSH_CLIENT" ]]; then
8+
print -n "@%m"
9+
fi
1410
}
1511

16-
12+
# Unused –
1713
function my_git_prompt_info() {
1814
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
1915
GIT_STATUS=$(git_prompt_status)
2016
[[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS"
2117
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/} $ZSH_THEME_GIT_PROMPT_SUFFIX"
2218
}
2319

24-
my_host() {
25-
if [[ -n "$SSH_CLIENT" ]]; then
26-
print -n "@%m"
27-
fi
28-
}
20+
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}  "
21+
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
2922

30-
31-
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}("
32-
ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}"
33-
ZSH_THEME_GIT_PROMPT_UNTRACKED=":"
34-
ZSH_THEME_GIT_PROMPT_ADDED="+"
35-
ZSH_THEME_GIT_PROMPT_MODIFIED="*"
36-
ZSH_THEME_GIT_PROMPT_RENAMED="~"
37-
ZSH_THEME_GIT_PROMPT_DELETED="!"
38-
ZSH_THEME_GIT_PROMPT_UNMERGED="?"
39-
40-
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%  "
41-
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
42-
# ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}%{$reset_color%} %{$fg[yellow]%}%1{✗%}"
43-
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}%{$reset_color%} %{$fg_bold[red]%}%1{✗%}"
23+
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[red]%}✗"
4424
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%} 🌼"
4525

46-
PROMPT='%{$fg[white]%}%n$(my_host)%{$reset_color%} %{$fg_bold[blue]%}%4~%{$reset_color%} $(git_prompt_info)%{$reset_color%}
26+
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[red]%}✚%{$reset_color%}"
27+
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[red]%}✹%{$reset_color%}"
28+
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}✖%{$reset_color%}"
29+
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[red]%}➜%{$reset_color%}"
30+
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}═%{$reset_color%}"
31+
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}✭%{$reset_color%}"
32+
33+
PROMPT='%{$fg[white]%}%n$(my_host)%{$reset_color%} %{$fg_bold[blue]%}%4~%{$reset_color%} $(git_prompt_info)$(git_prompt_status)%{$reset_color%}
4734
$ '
4835
RPS1="${return_code}"

0 commit comments

Comments
 (0)