initial dotfiles
This commit is contained in:
commit
a11473e308
20 changed files with 2831 additions and 0 deletions
38
zsh/custom/themes/bira-custom.zsh-theme
Normal file
38
zsh/custom/themes/bira-custom.zsh-theme
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||
local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%})%n@%m%{$reset_color%} "
|
||||
local user_symbol='%(!.#.$)'
|
||||
local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}"
|
||||
local conda_prompt='$(conda_prompt_info)'
|
||||
|
||||
local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
|
||||
local rvm_ruby='$(ruby_prompt_info)'
|
||||
local venv_prompt='$(virtualenv_prompt_info)'
|
||||
if [[ "${plugins[@]}" =~ 'kube-ps1' ]]; then
|
||||
local kube_prompt='$(kube_ps1)'
|
||||
else
|
||||
local kube_prompt=''
|
||||
fi
|
||||
|
||||
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
|
||||
|
||||
PROMPT="╭─${conda_prompt}${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}${kube_prompt}
|
||||
╰─%B${user_symbol}%b "
|
||||
RPROMPT="%B${return_code}%b"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[yellow]%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}"
|
||||
|
||||
ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
|
||||
ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||
ZSH_THEME_VIRTUALENV_PREFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX"
|
||||
ZSH_THEME_VIRTUALENV_SUFFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX"
|
||||
87
zsh/custom/themes/bira-nerd-2.zsh-theme
Normal file
87
zsh/custom/themes/bira-nerd-2.zsh-theme
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# =======================================================
|
||||
# bira-nerd.zsh-theme — custom prompt for JetBrainsMono Nerd Font
|
||||
# =======================================================
|
||||
|
||||
# --- Git / VCS styling ---
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%} %{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} %{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} %{$reset_color%}"
|
||||
|
||||
ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
|
||||
ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
|
||||
# --- Timer hooks ---
|
||||
preexec() {
|
||||
CMD_START=$EPOCHREALTIME
|
||||
}
|
||||
|
||||
precmd() {
|
||||
# ---------------- LEFT SIDE ----------------
|
||||
local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%}) %n@%m%{$reset_color%} "
|
||||
local current_dir="%B%{$fg[blue]%} %~%{$reset_color%}"
|
||||
local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
|
||||
local left="╭─${user_host}${current_dir}${vcs_branch}"
|
||||
|
||||
# ---------------- RIGHT SIDE ----------------
|
||||
# Python venv name
|
||||
local venv_right=""
|
||||
if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||
venv_right="%F{magenta}(${VIRTUAL_ENV:t})%f "
|
||||
fi
|
||||
|
||||
# Time
|
||||
local time_str="%F{242}%D{%H:%M:%S}%f"
|
||||
|
||||
# Duration (time taken for last command)
|
||||
local dur_str=""
|
||||
if [[ -n "$CMD_START" ]]; then
|
||||
local diff=$(( EPOCHREALTIME - CMD_START ))
|
||||
local secs=${diff%.*}
|
||||
local ms=${diff#*.}
|
||||
if (( secs > 0 )); then
|
||||
dur_str="%F{33}${secs}s%f"
|
||||
else
|
||||
dur_str="%F{33}${ms:0:2}ms%f"
|
||||
fi
|
||||
else
|
||||
dur_str="%F{33}0ms%f"
|
||||
fi
|
||||
|
||||
# Exit code (only visible if non-zero)
|
||||
local rc_str="%(?..%F{red}%?↵%f)"
|
||||
|
||||
local right="${venv_right}${time_str} ${dur_str} ${rc_str}"
|
||||
|
||||
# --- Manual right alignment on FIRST line ---
|
||||
local plain_left=${left//\%\{*%\}/}
|
||||
local plain_right=${right//\%\{*%\}/}
|
||||
local pad=$(( COLUMNS - ${#plain_left} - ${#plain_right} ))
|
||||
(( pad < 1 )) && pad=1
|
||||
local spaces="${(l:${pad}:: :)}"
|
||||
|
||||
# Two-line layout:
|
||||
# Line 1 = left + right
|
||||
# Line 2 = command symbol
|
||||
PROMPT="${left}${spaces}${right}\n
|
||||
╰─>%B%(!.#.$)%b "
|
||||
|
||||
RPROMPT="FITTE"
|
||||
CMD_START=""
|
||||
}
|
||||
|
||||
__RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
|
||||
if [[ -z $RPROMPT ]]; then
|
||||
RPROMPT=$__RPROMPT
|
||||
else
|
||||
RPROMPT="${RPROMPT} ${__RPROMPT}"
|
||||
fi
|
||||
|
||||
# --- Optional stylistic bits ---
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
|
||||
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||
|
||||
131
zsh/custom/themes/bira-nerd.zsh-theme
Normal file
131
zsh/custom/themes/bira-nerd.zsh-theme
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
# bira-nerd: Clean Bira-style 2-line prompt with Nerd icons
|
||||
# Line 1 (left): user@host, cwd, git, pyenv, venv
|
||||
# Line 1 (right): (venv) time duration exit code
|
||||
# Line 2: ╰─$ (root gets #)
|
||||
# No extra blank lines. No column-width hacks.
|
||||
|
||||
setopt prompt_subst
|
||||
|
||||
########################################
|
||||
# Helpers
|
||||
########################################
|
||||
|
||||
# Git: branch + dirty/clean
|
||||
_bira_nerd_git() {
|
||||
command git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
|
||||
local branch dirty
|
||||
branch=$(
|
||||
command git symbolic-ref --quiet --short HEAD 2>/dev/null ||
|
||||
command git rev-parse --short HEAD 2>/dev/null
|
||||
) || return
|
||||
|
||||
if ! command git diff --quiet --ignore-submodules --cached 2>/dev/null ||
|
||||
! command git diff --quiet --ignore-submodules 2>/dev/null; then
|
||||
dirty="%F{red}%f"
|
||||
else
|
||||
dirty="%F{green}%f"
|
||||
fi
|
||||
|
||||
echo "%F{yellow}%f ${branch} ${dirty}"
|
||||
}
|
||||
|
||||
# pyenv: show active version if not "system"
|
||||
_bira_nerd_pyenv() {
|
||||
command -v pyenv &>/dev/null || return
|
||||
local v
|
||||
v=$(pyenv version-name 2>/dev/null) || return
|
||||
[[ -n "$v" && "$v" != "system" ]] || return
|
||||
echo " ${v}"
|
||||
}
|
||||
|
||||
########################################
|
||||
# Timing
|
||||
########################################
|
||||
|
||||
preexec() {
|
||||
BIRA_NERD_START=$EPOCHREALTIME
|
||||
}
|
||||
|
||||
########################################
|
||||
# precmd: build first line (no printing)
|
||||
########################################
|
||||
|
||||
precmd() {
|
||||
local left git_info pyenv_info vp
|
||||
|
||||
# Start with top-left glyph
|
||||
left="╭─"
|
||||
|
||||
# conda (if available)
|
||||
if (( $+functions[conda_prompt_info] )); then
|
||||
left+="$(conda_prompt_info)"
|
||||
fi
|
||||
|
||||
# user@host with icon (includes trailing space)
|
||||
local user_host="%B%(!.%F{red}.%F{green}) %n@%m%f%b "
|
||||
# cwd with folder icon (no trailing space)
|
||||
local current_dir="%B%F{blue} %~%f%b"
|
||||
|
||||
left+="${user_host}${current_dir}"
|
||||
|
||||
# git info
|
||||
git_info="$(_bira_nerd_git)"
|
||||
[[ -n "$git_info" ]] && left+=" ${git_info}"
|
||||
|
||||
# pyenv info
|
||||
pyenv_info="$(_bira_nerd_pyenv)"
|
||||
[[ -n "$pyenv_info" ]] && left+=" %F{magenta}${pyenv_info}%f"
|
||||
|
||||
# left-side venv (oh-my-zsh virtualenv plugin, if present)
|
||||
if (( $+functions[virtualenv_prompt_info] )); then
|
||||
vp="$(virtualenv_prompt_info)"
|
||||
[[ -n "$vp" ]] && left+=" ${vp}"
|
||||
fi
|
||||
|
||||
# ---------- RIGHT SIDE SEGMENTS ----------
|
||||
|
||||
local -a right_parts
|
||||
|
||||
# (venv) from raw $VIRTUAL_ENV on the right
|
||||
if [[ -n "$VIRTUAL_ENV" ]]; then
|
||||
right_parts+=( "%F{magenta}(${VIRTUAL_ENV:t})%f" )
|
||||
fi
|
||||
|
||||
# time
|
||||
right_parts+=( "%F{242}%D{%H:%M:%S}%f" )
|
||||
|
||||
# duration of last command
|
||||
if [[ -n "$BIRA_NERD_START" ]]; then
|
||||
local diff secs ms
|
||||
diff=$(( EPOCHREALTIME - BIRA_NERD_START ))
|
||||
secs=${diff%.*}
|
||||
ms=${diff#*.}
|
||||
if (( secs > 0 )); then
|
||||
right_parts+=( "%F{33}${secs}s%f" )
|
||||
else
|
||||
right_parts+=( "%F{33}${ms:0:2}ms%f" )
|
||||
fi
|
||||
fi
|
||||
|
||||
# exit code (only when non-zero)
|
||||
right_parts+=( "%(?..%F{red}%?↵%f)" )
|
||||
|
||||
# Join right segments with single spaces
|
||||
local right="${(j: :)right_parts}"
|
||||
|
||||
# Final first line: left + ONE space + right
|
||||
BIRA_NERD_LINE1="${left} ${right}"
|
||||
|
||||
# reset timer
|
||||
BIRA_NERD_START=""
|
||||
}
|
||||
|
||||
########################################
|
||||
# Two-line prompt
|
||||
########################################
|
||||
|
||||
PROMPT='${BIRA_NERD_LINE1}
|
||||
╰─%B%(!.#.$)%b '
|
||||
RPROMPT=''
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue