mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 19:11:30 +01:00
update oh-my-zsh theme
This commit is contained in:
parent
38c3b21a85
commit
da99fdd2f7
|
@ -1,8 +1,70 @@
|
|||
local ret_status="%(?:%{$fg_bold[green]%}➜%{$reset_color%}:%{$fg[red]%}➜%{$reset_color%})"
|
||||
local user="%(#:root@:)"
|
||||
PROMPT='[%*][%{$fg[red]%}${user}%M%{$reset_color%}][:%{$fg[green]%}%c%{$reset_color%}]$(git_prompt_info) ${ret_status} '
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
# color chart available at https://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
|
||||
# %F{202}: orange
|
||||
# %K{202}: background orange
|
||||
# 255: white
|
||||
# See the prompt expansion section in `info zsh` for more info
|
||||
|
||||
local USER_PROMPT="%(#.%K{160}%F{255}[root]%k%f.)" # root printed on a red background # TODO: add lightning here
|
||||
local JOB_PROMPT="%(1j.%B%K{202}%F{220} %j %k%b.)" # Shows jobs number on an orange background if there are background jobs
|
||||
local SHLVL_PROMPT="%(2L.%K{161}%F{255}%B %L %f%b%k.)" # Shows SHLVL on a magenta background if SHLVL > 1
|
||||
local PATH_PROMPT="%F{white}[%F{green}%(4~:…/%3~:%~)%F{white}]%f" # Shows last 3 items in path if there are more than 4
|
||||
|
||||
# PREFIX/SUFFIX are added before/after `git_prompt_info`
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%f%{$fg[yellow]%} "
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%} %{$fg[red]%}✗%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%} %{$fg[green]%}√%{$reset_color%}"
|
||||
|
||||
# The following are part of `git_prompt_status`
|
||||
# Rules:
|
||||
# ? : untracked
|
||||
# * : modified
|
||||
# + : added
|
||||
# $ : stashed
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%B%F{red}?%b%f" # red
|
||||
# ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[red]%}±" # this is equivalent to DIRTY, if DISABLE_UNTRACKED_FILES_DIRTY is set
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%B%F{34}+%b%f" # green
|
||||
ZSH_THEME_GIT_PROMPT_STASHED="%B%F{32}$%b%f" # blue
|
||||
|
||||
# The following are part of `git_remote_status`
|
||||
# ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="%{$fg[green]%}="
|
||||
ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE=""
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE="%F{255}>%f"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="%F{255}<%f"
|
||||
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="%F{255}<>%f"
|
||||
|
||||
function virtualenv_info {
|
||||
[ $VIRTUAL_ENV ] && echo ' %F{27}<'$(basename $VIRTUAL_ENV)'> %f'
|
||||
}
|
||||
|
||||
function git_prompt() {
|
||||
if [[ -n "$(git status 2>/dev/null)" ]]; then
|
||||
local GIT_PROMPT="%F{255}($(git_prompt_info)$(git_prompt_status)$(git_remote_status)%F{255})%f"
|
||||
echo "$GIT_PROMPT"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function check_last_exit_code() {
|
||||
local LAST_EXIT_CODE=$?
|
||||
if [[ $LAST_EXIT_CODE -ne 0 ]]; then
|
||||
local EXIT_CODE_PROMPT=' '
|
||||
# EXIT_CODE_PROMPT+="%{$fg[red]%}-%{$reset_color%}"
|
||||
# EXIT_CODE_PROMPT+="%{$fg_bold[red]%}$LAST_EXIT_CODE%{$reset_color%}"
|
||||
EXIT_CODE_PROMPT+="%B%F{88}-$LAST_EXIT_CODE-%f%b"
|
||||
# EXIT_CODE_PROMPT+="%{$fg[red]%}-%{$reset_color%}"
|
||||
echo "$EXIT_CODE_PROMPT"
|
||||
fi
|
||||
}
|
||||
|
||||
local return_code="%(?.."'$(check_last_exit_code)'")" # for RPS1
|
||||
local ret_status="%(?:%B%F{28} →%f%b:%{$fg[red]%} ✗%{$reset_color%})" # for PS1
|
||||
|
||||
|
||||
# Prompt looks like this: <virtualenv> [user][path](git)[jobn][shlvl] retstatus
|
||||
PROMPT='$(virtualenv_info)'"${USER_PROMPT}${PATH_PROMPT}"'$(git_prompt)'"${JOB_PROMPT}${SHLVL_PROMPT}${ret_status} "
|
||||
# Right prompt is just return code and time
|
||||
RPS1="${return_code} %F{255}[%*]%f"
|
||||
|
|
Loading…
Reference in New Issue
Block a user