zshrc: Add an option to get the old simple prompt
This commit is contained in:
parent
eb1a601086
commit
b59c4cf08c
1 changed files with 26 additions and 12 deletions
38
zshrc
38
zshrc
|
@ -9,6 +9,7 @@ local ls=""
|
||||||
local ls_color="auto"
|
local ls_color="auto"
|
||||||
local ls_on_cd="yes"
|
local ls_on_cd="yes"
|
||||||
local ls_on_init="no"
|
local ls_on_init="no"
|
||||||
|
local simple_prompt="no"
|
||||||
|
|
||||||
bindkey -v
|
bindkey -v
|
||||||
# history-incremental-search-backward is much more useful than
|
# history-incremental-search-backward is much more useful than
|
||||||
|
@ -67,22 +68,35 @@ case $TERM_PROGRAM in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
set_prompt() {
|
if [ "$simple_prompt" = yes ]; then
|
||||||
PS1="%F{23}%m %F{29}%c$1%F{36}%(!.#.>)%f "
|
set_prompt() {
|
||||||
PS2="%B>%b "
|
local branch
|
||||||
RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)"
|
[ -n "$1" ] && branch="%F{black}%B(%b%F{cyan}$1%F{black}%B)%b%f"
|
||||||
RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
|
|
||||||
}
|
PS1="%m:%c$branch%B%(!.#.$)%b "
|
||||||
|
PS2="%B>%b "
|
||||||
|
RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)"
|
||||||
|
RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
set_prompt() {
|
||||||
|
local branch
|
||||||
|
[ -n "$1" ] && branch="%F{36}(%F{78}$1%F{36})"
|
||||||
|
|
||||||
|
PS1="%F{23}%m %F{29}%c$branch%F{36}%(!.#.>)%f "
|
||||||
|
PS2="%B>%b "
|
||||||
|
RPS1="%(1j.%F{yellow}%j%f.)%(?..%(1j. .)%F{red}%?%f)"
|
||||||
|
RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
|
||||||
|
}
|
||||||
|
fi
|
||||||
set_prompt
|
set_prompt
|
||||||
|
|
||||||
__precmd() {
|
__precmd() {
|
||||||
__update_terminal_cwd
|
__update_terminal_cwd
|
||||||
|
|
||||||
local branch_name=$(git symbolic-ref HEAD 2>/dev/null)
|
local branch=$(git symbolic-ref HEAD 2>/dev/null)
|
||||||
branch_name=${branch_name##refs/heads/}
|
branch=${branch##refs/heads/}
|
||||||
if [ -n "$branch_name" -a "$branch_name" != master ]; then
|
[ "$branch" = master ] && branch=""
|
||||||
local branch="%F{36}(%F{78}$branch_name%F{36})"
|
|
||||||
fi
|
|
||||||
set_prompt $branch
|
set_prompt $branch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,5 +215,5 @@ alias pws="__pw -k ~/.cryptopassphrase-server.key"
|
||||||
ixio() { curl -F 'f:1=<-' ix.io }
|
ixio() { curl -F 'f:1=<-' ix.io }
|
||||||
0x0st() { curl -F'file=@-' https://0x0.st }
|
0x0st() { curl -F'file=@-' https://0x0.st }
|
||||||
|
|
||||||
unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init
|
unset fgrep grep grep_color ls ls_color ls_on_cd ls_on_init simple_prompt
|
||||||
unset HISTFILE
|
unset HISTFILE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue