SelimovDE/home/.zshrc

157 lines
4.6 KiB
Bash
Raw Normal View History

#==============================================================================
# Zsh Configuration
#==============================================================================
# History settings
2024-12-12 20:16:38 -05:00
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
2024-12-12 20:16:38 -05:00
setopt extendedglob notify
unsetopt autocd beep
setopt INC_APPEND_HISTORY # Write to history file immediately, not when shell exits
2025-09-24 10:02:58 -04:00
setopt APPEND_HISTORY # Append instead of overwriting the file
setopt HIST_IGNORE_DUPS # Don't save duplicate commands
setopt HIST_IGNORE_SPACE # Don't save commands starting with space
2024-12-12 20:16:38 -05:00
#==============================================================================
# Environment Variables
#==============================================================================
2025-01-15 22:59:08 -05:00
2024-12-12 20:16:38 -05:00
export OMPI_MCA_rmaps_base_oversubscribe=1
export CLICOLOR=1
export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd
export LS_COLORS='di=1;37:ln=35:so=32:pi=33:ex=1;32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43'
export XKB_DEFAULT_OPTIONS="caps:escape"
export PASSWORD_STORE_CHARACTER_SET='a-zA-Z0-9+\-$!*_='
export XDEB_PKGROOT=${HOME}/.config/xdeb
2025-09-15 07:22:32 -04:00
# Custom path additions
2025-09-22 20:45:55 -04:00
source ~/.profile
2025-09-15 07:22:32 -04:00
#==============================================================================
2025-09-22 20:45:55 -04:00
# Aliases
2025-09-15 07:22:32 -04:00
#==============================================================================
2025-09-22 20:45:55 -04:00
alias clip2png="xclip -selection clipboard -target image/png -out"
#==============================================================================
# Functions
#==============================================================================
load_env() {
set -a
2025-09-18 09:47:45 -04:00
. "./$1"
set +a
2024-12-12 20:16:38 -05:00
}
#==============================================================================
# Completions
#==============================================================================
autoload -Uz compinit
compinit
zstyle ':compinstall' filename '/home/aselimov/.zshrc'
zstyle -e ':completion:*:hosts' hosts 'reply=(
${=${${(f)"$(cat {/etc/ssh_,~/ar.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//,/ }
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
)'
2024-12-12 20:16:38 -05:00
#==============================================================================
# Plugins & Tools
#==============================================================================
2024-12-12 20:16:38 -05:00
# nvm
# Lazy-load nvm - only initialize when first used
2024-12-12 20:16:38 -05:00
export NVM_DIR="$HOME/.nvm"
# Function to load nvm (called only once)
load_nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
}
# Create placeholder functions that load nvm once, then call the real command
nvm() {
2025-09-18 23:36:31 -04:00
unset -f nvm node npm gemini
load_nvm
nvm "$@"
}
node() {
2025-09-18 23:36:31 -04:00
unset -f nvm node npm gemini
load_nvm
node "$@"
}
npm() {
2025-09-18 23:36:31 -04:00
unset -f nvm node npm gemini
load_nvm
npm "$@"
}
2024-12-12 20:16:38 -05:00
2025-09-18 23:36:31 -04:00
gemini() {
unset -f nvm node npm gemini
load_nvm
gemini "$@"
}
# ghcup
2025-01-15 22:59:08 -05:00
[ -f "/home/aselimov/.ghcup/env" ] && . "/home/aselimov/.ghcup/env" # ghcup-env
2025-05-26 22:27:48 -04:00
# pyenv
2025-09-15 07:22:32 -04:00
if command -v pyenv >/dev/null 2>&1; then
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - zsh)"
fi
2025-09-15 07:22:32 -04:00
# jenv
if command -v jenv >/dev/null 2>&1; then
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
fi
# starship
eval "$(starship init zsh)"
# zsh-autosuggestions
source "$HOME/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh"
# zsh-syntax-highlighting
source "$HOME/.config/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
# zsh-history-substring-search
source "$HOME/.config/zsh/zsh-history-substring-search/zsh-history-substring-search.zsh"
#==============================================================================
# Keybindings
#==============================================================================
bindkey -v
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
#==============================================================================
# OS-Specific Configuration
#==============================================================================
if [ "$(uname)" = "Darwin" ]; then
2025-09-24 10:02:58 -04:00
export PATH="/opt/homebrew/bin:$PATH"
alias ls="gls --classify --group-directories-first --color"
2025-09-22 20:45:55 -04:00
GEMINI_BIN=$(which gemini)
function gemini(){
source ~/.gemini_project && $GEMINI_BIN "$@"
}
export NVIM_JDTLS_JAVA_HOME="/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home/"
# I only start tmux by default on Mac because of dwm+swallow patch
else
alias ls="ls --classify --group-directories-first --color"
fi
if [[ -z "$TMUX" ]] && [[ -n "$PS1" ]]; then
tmux attach -t dev || tmux new -s dev
fi