mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 19:11:30 +01:00
zsh: themes: cleanup, make functions private
This commit is contained in:
parent
f03f0f6105
commit
8a72eaff6f
|
@ -3,7 +3,6 @@ export LANG=en_US.UTF-8
|
|||
|
||||
# theme-related variables
|
||||
export ZSH_CUSTOM="$DOTFILES"
|
||||
export ZSH_THEME="brethil"
|
||||
export DISABLE_UNTRACKED_FILES_DIRTY=true
|
||||
export VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||
|
||||
|
|
|
@ -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_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%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}✗%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}√%{$reset_color%}"
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
# See "EXPANSION OF PROMPT SEQUENCES" in `man zshmisc`
|
||||
# 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 host='%K{202}%B%F{255}%m%f%k%b' # bold host name on an orange background
|
||||
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_SUFFIX="%{$reset_color%} |"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[white]%}%{$fg[red]%}x%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[white]%}%{$fg[green]%}√%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}√%{$reset_color%}"
|
||||
|
||||
# The following are part of `git_prompt_status`
|
||||
# Rules:
|
||||
|
@ -59,7 +57,7 @@ ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
|
|||
local BOLD_PURPLE='%B%F{5}'
|
||||
local CLEAR='%f%b'
|
||||
local venv
|
||||
function virtualenv_info {
|
||||
function __virtualenv_info {
|
||||
[ -z "$VIRTUAL_ENV" ] && return
|
||||
venv="$(basename "$VIRTUAL_ENV")"
|
||||
if [[ "$venv" == ".venv" ]]; then
|
||||
|
@ -77,9 +75,9 @@ local return_code_RPS1='%(?..%B%F{88}-$?-%f%b)'
|
|||
|
||||
local success="%B%F{28} →%f%b"
|
||||
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`
|
||||
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
|
||||
|
||||
# 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
|
||||
RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]'
|
||||
|
|
Loading…
Reference in New Issue
Block a user