-
Notifications
You must be signed in to change notification settings - Fork 2
/
10-prompt.rc
47 lines (39 loc) · 1.84 KB
/
10-prompt.rc
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
46
47
# shellcheck disable=SC2148 disable=SC1090 disable=SC2034 disable=SC2154 disable=SC1087 shell=bash
### Prompt! ###
autoload -U colors && colors
# Outputs current branch info in prompt format
function git_prompt_info() {
local ref
# if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
# ref=$(command git symbolic-ref HEAD 2>/dev/null) || - ref=$(command git rev-parse --short HEAD 2>/dev/null) || return 0
# echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref#refs/heads/}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
# fi
}
# show git changes on the command line
autoload -Uz vcs_info add-zsh-hook
setopt prompt_subst
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:*' enable git
precmd() {
vcs_info
}
# Enable checking for (un)staged changes, enabling use of %u and %c
zstyle ':vcs_info:*' check-for-changes true
# Set custom strings for an unstaged vcs repo changes (*) and staged changes (+)
# zstyle ':vcs_info:*' unstagedstr ' [*unstaged]'
# zstyle ':vcs_info:*' stagedstr '[+staged]'
# Set the format of the Git information for vcs_info
zstyle ':vcs_info:git:*' formats '(%b%u%c)'
zstyle ':vcs_info:git:*' actionformats '(%b|%a%u%c)'
# add the number of unstaged/staged changes to the prompt
zstyle ':vcs_info:git:*' enable git
# %s - The current version control system, like git or svn.
# %r - The name of the root directory of the repository
# %S - The current path relative to the repository root directory
# %b - Branch information, like master
# %m - In case of Git, show information about stashes
# %u - Show unstaged changes in the repository
# %c - Show staged changes in the repository
RPROMPT="%{$(tput setaf 177)%}\$vcs_info_msg_0_"
PROMPT="%{$(tput setaf 60)%}%m %{$(tput setaf 105)%}%~${vcs_info_msg_0_}%{$(tput sgr0)%} %(?..[%?] )$ "