-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zsh_prompt
47 lines (39 loc) · 1.06 KB
/
.zsh_prompt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
PROMPT_DIRTRIM=2
# Load version control info
autoload -Uz add-zsh-hook vcs_info
add-zsh-hook precmd vcs_info
# Checks unstaged files
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr ' ?'
zstyle ':vcs_info:*' stagedstr ' +'
# Format vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats '(%b%u%c)'
# Enable substitution for the prompt
setopt prompt_subst
bold='%B';
reset="%f";
black="%F{black}";
blue="%F{blue}";
cyan="%F{cyan}";
green="%F{green}";
orange="%F{208}";
purple="%F{129}";
red="%F{red}";
violet="%F{magenta}";
white="%F{white}";
yellow="%F{yellow}";
grey="%F{240}";
# Highlight the user name when logged in as root.
if [[ "${USER}" == "root" ]]; then
userStyle="${bold}${red}";
else
userStyle="${green}";
fi;
# Set the terminal title and prompt.
# Looks like:
# user:~/short/path $
PROMPT='${userStyle}%n${reset}:${blue}%${PROMPT_DIRTRIM}~${reset} '; # working directory base name
PROMPT+='${cyan}${vcs_info_msg_0_}${reset}'; # Add git branch name
PROMPT+='${black}\$${reset} ';
export PROMPT;