initial dotfiles

This commit is contained in:
Mats Ricardo Nomedal 2026-04-23 23:48:01 +02:00
commit a11473e308
20 changed files with 2831 additions and 0 deletions

View 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%}"