Skip to content

Commit 61e99c3

Browse files
committed
zsh: update prompt
1 parent 0e1c593 commit 61e99c3

1 file changed

Lines changed: 17 additions & 22 deletions

File tree

zsh/prompt

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,35 @@ autoload -Uz add-zsh-hook
55
zstyle ':vcs_info:*' enable git
66
zstyle ':vcs_info:git*:*' get-revision true
77
zstyle ':vcs_info:git*:*' check-for-changes true
8-
zstyle ':vcs_info:git*:*' unstagedstr "+" # %u
9-
zstyle ':vcs_info:git*:*' stagedstr "*" # %c
10-
zstyle ':vcs_info:git*' actionformats "%b %c%u|%a"
11-
zstyle ':vcs_info:git*' formats "%b %c%u"
8+
zstyle ':vcs_info:git*:*' unstagedstr "%F{red}•%f" # %u below
9+
zstyle ':vcs_info:git*:*' stagedstr "%F{green}•%f" # %c below
10+
zstyle ':vcs_info:git*' actionformats "%F{magenta}%a:%f%F{green}%b%f %u%c"
11+
zstyle ':vcs_info:git*' formats "%F{green}%b%f %u%c"
12+
13+
_josh_prompt_vcs_info() {
14+
vcs_info 2> /dev/null
15+
16+
if [[ -n "${vcs_info_msg_0_}" ]]; then
17+
echo " %F{green}(%f${vcs_info_msg_0_%% }%F{green})%f"
18+
fi
19+
}
1220

1321
_josh_prompt_precmd() {
14-
local git_prompt="" user_format="%n@" host_prompt="" host_format="%M" dir_prompt git_info
22+
local git_prompt user_format="${${USER:#priddle1}:+%n@}" host_prompt="" host_format="%m" dir_prompt
1523

16-
# if [[ -n $SSH_CONNECTION ]] && [[ -z $TMUX ]]; then
1724
if [[ -n $SSH_CONNECTION ]]; then
18-
[[ $HOST =~ (\.local|\.lan|\.priddle\.network)$ ]] && host_format="%m"
19-
20-
host_prompt="%{$fg_bold[yellow]%}${user_format}${host_format}%{$reset_color%} "
25+
host_prompt="%F{yellow}${user_format}${host_format}%f:"
2126
fi
2227

2328
if [[ $TERM == xterm* ]]; then
2429
print -Pn "\\e]0;${SSH_CONNECTION:+${user_format}${host_format}:}%~\\a"
2530
fi
2631

27-
vcs_info 2> /dev/null
28-
29-
if [[ -n $vcs_info_msg_0_ ]]; then
30-
# Strip space from " |"
31-
git_info="${vcs_info_msg_0_// |/|}"
32-
33-
# Strip trailing space
34-
git_info="${git_info%\ }"
35-
36-
git_prompt=" %{$fg_bold[green]%}(${git_info})%{$reset_color%}"
37-
fi
32+
git_prompt="$(_josh_prompt_vcs_info)"
3833

39-
dir_prompt="%{$fg_bold[blue]%}%3~%{$reset_color%}"
34+
dir_prompt="%F{blue}%3~%f"
4035

41-
PS1="${host_prompt}${dir_prompt}${git_prompt} %# "
36+
PS1="%B${host_prompt}${dir_prompt}${git_prompt}%b %# "
4237
}
4338

4439
add-zsh-hook precmd _josh_prompt_precmd

0 commit comments

Comments
 (0)