[prompt] Remove autoload -Uz colors
since we don't need that. We're using the newer '%F{red}color%f' code instead. Also use `PS1` instead of `PROMPT`, as suggested at `man zshcontrib`, under "Writing Themes”. Refactor code.
This commit is contained in:
parent
451e51bd88
commit
2d1aea3b74
3 changed files with 14 additions and 22 deletions
|
@ -107,13 +107,10 @@ prompt_eriner_precmd() {
|
|||
}
|
||||
|
||||
prompt_eriner_setup() {
|
||||
autoload -Uz colors && colors
|
||||
autoload -Uz add-zsh-hook
|
||||
autoload -Uz add-zsh-hook && add-zsh-hook precmd prompt_eriner_precmd
|
||||
|
||||
prompt_opts=(cr percent sp subst)
|
||||
|
||||
add-zsh-hook precmd prompt_eriner_precmd
|
||||
|
||||
local prompt_eriner_color3=${3:-green}
|
||||
local prompt_eriner_color4=${4:-yellow}
|
||||
|
||||
|
@ -131,7 +128,7 @@ prompt_eriner_setup() {
|
|||
}
|
||||
|
||||
prompt_eriner_preview () {
|
||||
if (( $# )); then
|
||||
if (( ${#} )); then
|
||||
prompt_preview_theme eriner "${@}"
|
||||
else
|
||||
prompt_preview_theme eriner
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
# vim:et sts=2 sw=2 ft=zsh
|
||||
#
|
||||
# Gitster theme
|
||||
# https://github.com/shashankmehta/dotfiles/blob/master/thesetup/zsh/.oh-my-zsh/custom/themes/gitster.zsh-theme
|
||||
#
|
||||
# Requires the `git-info` zmodule to be included in the .zimrc file.
|
||||
|
||||
prompt_gitster_status() {
|
||||
print -n '%(?:%F{green}:%F{red})➜ '
|
||||
}
|
||||
|
||||
prompt_gitster_pwd() {
|
||||
prompt_short_dir=$(short_pwd)
|
||||
git_root=$(command git rev-parse --show-toplevel 2> /dev/null) && prompt_short_dir=${prompt_short_dir#${$(short_pwd $git_root):h}/}
|
||||
|
@ -23,13 +20,12 @@ prompt_gitster_precmd() {
|
|||
}
|
||||
|
||||
prompt_gitster_setup() {
|
||||
autoload -Uz colors && colors
|
||||
autoload -Uz add-zsh-hook
|
||||
local prompt_gitster_status='%(?:%F{green}:%F{red})➜ '
|
||||
|
||||
autoload -Uz add-zsh-hook && add-zsh-hook precmd prompt_gitster_precmd
|
||||
|
||||
prompt_opts=(cr percent sp subst)
|
||||
|
||||
add-zsh-hook precmd prompt_gitster_precmd
|
||||
|
||||
zstyle ':zim:git-info:branch' format '%b'
|
||||
zstyle ':zim:git-info:commit' format '%c'
|
||||
zstyle ':zim:git-info:clean' format '%F{green}✓'
|
||||
|
@ -37,8 +33,8 @@ prompt_gitster_setup() {
|
|||
zstyle ':zim:git-info:keys' format \
|
||||
'prompt' ' %F{cyan}%b%c %C%D'
|
||||
|
||||
PROMPT="$(prompt_gitster_status)\$(prompt_gitster_pwd)\$(prompt_gitster_git)%f "
|
||||
RPROMPT=''
|
||||
PS1="${prompt_gitster_status}\$(prompt_gitster_pwd)\$(prompt_gitster_git)%f "
|
||||
RPS1=''
|
||||
}
|
||||
|
||||
prompt_gitster_setup "$@"
|
||||
prompt_gitster_setup "${@}"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# vim:et sts=2 sw=2 ft=zsh
|
||||
#
|
||||
# magicmace theme
|
||||
# Ideas and code taken from:
|
||||
|
@ -50,13 +51,11 @@ prompt_magicmace_precmd() {
|
|||
}
|
||||
|
||||
prompt_magicmace_setup() {
|
||||
autoload -Uz add-zsh-hook && add-zsh-hook precmd prompt_magicmace_precmd
|
||||
autoload -Uz colors && colors
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
prompt_opts=(cr percent sp subst)
|
||||
|
||||
add-zsh-hook precmd prompt_magicmace_precmd
|
||||
|
||||
zstyle ':zim:git-info:branch' format '%b'
|
||||
zstyle ':zim:git-info:commit' format '%c...'
|
||||
zstyle ':zim:git-info:dirty' format '*'
|
||||
|
@ -66,8 +65,8 @@ prompt_magicmace_setup() {
|
|||
'prompt' '─[${COLOR_NORMAL}%b%c%D%A%B${COLOR_USER_LEVEL}]'
|
||||
|
||||
# Call git directly, ignoring aliases under the same name.
|
||||
PROMPT='${COLOR_USER_LEVEL}$(prompt_magicmace_status)[${COLOR_NORMAL}$(short_pwd)${COLOR_USER_LEVEL}]$(prompt_magicmace_git)── ─%f '
|
||||
RPROMPT=''
|
||||
PS1='${COLOR_USER_LEVEL}$(prompt_magicmace_status)[${COLOR_NORMAL}$(short_pwd)${COLOR_USER_LEVEL}]$(prompt_magicmace_git)── ─%f '
|
||||
RPS1=''
|
||||
}
|
||||
|
||||
prompt_magicmace_setup "$@"
|
||||
prompt_magicmace_setup "${@}"
|
||||
|
|
Loading…
Reference in a new issue