feat: prompt setup improvements

This commit is contained in:
2025-05-19 23:10:26 +03:00
parent 11e2bc95a7
commit 755054c11e
4 changed files with 93 additions and 100 deletions

View File

@@ -1,15 +1,66 @@
source $HOME/.profile
# Prefix all functions with "_dots" for easier profiling
# -----------------------------------------------------------------------------
if [[ -n "$ZSH_BENCH" ]]; then
zmodload zsh/zprof
fi
export DISABLE_AUTO_UPDATE="true"
export ZSH="$HOME/.oh-my-zsh"
# Load profile
# -----------------------------------------------------------------------------
_dots_load_profile() {
source $HOME/.profile
}
_dots_load_profile
# https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
plugins=(
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# Load oh-my-zsh
# -----------------------------------------------------------------------------
_dots_load_omz() {
export DISABLE_AUTO_UPDATE="true"
export ZSH="$HOME/.oh-my-zsh"
plugins=(
z
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
}
_dots_load_omz
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Load nvm
# -----------------------------------------------------------------------------
_dots_load_nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
}
_dots_load_nvm
# -----------------------------------------------------------------------------
_dots_load_brew() {
export HOMEBREW_NO_ANALYTICS=1
[ -x "/opt/homebrew/bin/brew" ] && eval "$(/opt/homebrew/bin/brew shellenv)"
}
_dots_load_brew
# -----------------------------------------------------------------------------
_dots_load_pyenv() {
[ -x `command -v pyenv` ] && eval "$(pyenv init --path)"
}
_dots_load_pyenv
# -----------------------------------------------------------------------------
_dots_build_prompt() {
local final_prompt=""
local dir_section="%{$fg_bold[blue]%}%~"
final_prompt+="$dir_section "
local prompt_char="%{$reset_color%}%%"
final_prompt+="$prompt_char "
PROMPT="$final_prompt"
}
_dots_build_prompt
# -----------------------------------------------------------------------------
if [[ -n "$ZSH_BENCH" ]]; then
zprof
fi