1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-22 11:31:30 +01:00

zsh: themes: cleanup, make functions private

This commit is contained in:
bretello 2024-08-12 17:27:55 +02:00
parent f03f0f6105
commit 8a72eaff6f
3 changed files with 8 additions and 11 deletions

View File

@ -3,7 +3,6 @@ export LANG=en_US.UTF-8
# theme-related variables # theme-related variables
export ZSH_CUSTOM="$DOTFILES" export ZSH_CUSTOM="$DOTFILES"
export ZSH_THEME="brethil"
export DISABLE_UNTRACKED_FILES_DIRTY=true export DISABLE_UNTRACKED_FILES_DIRTY=true
export VIRTUAL_ENV_DISABLE_PROMPT=true export VIRTUAL_ENV_DISABLE_PROMPT=true

View File

@ -6,5 +6,5 @@ PROMPT='[%{$fg[red]%}${user}%M%{$reset_color%}][:%{$fg[green]%}%c%{$reset_color%
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:("
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%} %{$fg[red]%}✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%} %{$fg[green]%}√%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}√%{$reset_color%}"

View File

@ -3,8 +3,6 @@
# See "EXPANSION OF PROMPT SEQUENCES" in `man zshmisc` # See "EXPANSION OF PROMPT SEQUENCES" in `man zshmisc`
# Note: Most of the expansions/color sequences can be tested using `print -P` # Note: Most of the expansions/color sequences can be tested using `print -P`
# prints hostname on an orange background if on an ssh connection, adds username if root
local user='%(!.%K{160}%F{255}%B%n%b%k%f.)' # prints 'root' on a red background if user is root local user='%(!.%K{160}%F{255}%B%n%b%k%f.)' # prints 'root' on a red background if user is root
local host='%K{202}%B%F{255}%m%f%k%b' # bold host name on an orange background local host='%K{202}%B%F{255}%m%f%k%b' # bold host name on an orange background
local open_bracket='%(!.[.)' local open_bracket='%(!.[.)'
@ -35,8 +33,8 @@ local path_prompt='[%F{green}%(4~:…/%3~:%~)%f]'
ZSH_THEME_GIT_PROMPT_PREFIX=" %f%{$fg[yellow]%} " ZSH_THEME_GIT_PROMPT_PREFIX=" %f%{$fg[yellow]%} "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} |" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} |"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[white]%}%{$fg[red]%}x%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[white]%}%{$fg[green]%}√%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}√%{$reset_color%}"
# The following are part of `git_prompt_status` # The following are part of `git_prompt_status`
# Rules: # Rules:
@ -59,7 +57,7 @@ ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
local BOLD_PURPLE='%B%F{5}' local BOLD_PURPLE='%B%F{5}'
local CLEAR='%f%b' local CLEAR='%f%b'
local venv local venv
function virtualenv_info { function __virtualenv_info {
[ -z "$VIRTUAL_ENV" ] && return [ -z "$VIRTUAL_ENV" ] && return
venv="$(basename "$VIRTUAL_ENV")" venv="$(basename "$VIRTUAL_ENV")"
if [[ "$venv" == ".venv" ]]; then if [[ "$venv" == ".venv" ]]; then
@ -79,7 +77,7 @@ local success="%B%F{28} →%f%b"
local failure="%B%{$fg[red]%} x%b%{$reset_color%}" local failure="%B%{$fg[red]%} x%b%{$reset_color%}"
local prompt_with_previous_return_status="%(?:$success:$failure)" local prompt_with_previous_return_status="%(?:$success:$failure)"
function prompt_too_long(){ function __prompt_too_long(){
# prints a newline if less than $COLUMNS/2 characters remain to the right margin, see end of `man zshmisc` # prints a newline if less than $COLUMNS/2 characters remain to the right margin, see end of `man zshmisc`
echo "%-$((COLUMNS/2))(l..\n)" echo "%-$((COLUMNS/2))(l..\n)"
} }
@ -89,7 +87,7 @@ export MODE_INDICATOR="[%B%K{red}nav%k%b]" # red background
export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]" # green background export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]" # green background
# put it all together # put it all together
PROMPT='$(virtualenv_info)'"${user_prompt}${path_prompt}${git_prompt}${job_prompt}${shlvl_prompt}$(prompt_too_long)${prompt_with_previous_return_status}" PROMPT='$(__virtualenv_info)'"${user_prompt}${path_prompt}${git_prompt}${job_prompt}${shlvl_prompt}$(__prompt_too_long)${prompt_with_previous_return_status}"
# Right prompt is just return code and time # Right prompt is just return code and time
RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]' RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]'