gentoo-legion/shell/zshrc.example
2026-01-24 20:47:35 -05:00

129 lines
3.6 KiB
Plaintext

# ~/.zshrc
# Gentoo + Hyprland zsh configuration
export TERM="xterm-256color"
# --- Basic Zsh Configuration ---
# Set default editor
export EDITOR="nano" # Or "vim", "nvim", etc.
# History settings
HISTFILE=~/.zsh_history
SAVEHIST=10000 # Number of history entries to save
HISTSIZE=10000 # Number of history entries to keep in memory
setopt appendhistory # Append history to the history file
setopt sharehistory # Share history among all sessions
setopt hist_ignore_dups # Ignore duplicate commands
setopt hist_verify # Ask for confirmation before executing history expansion
# Autocompletion
autoload -U compinit
compinit
# Better completion styling
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%F{yellow}-- %d --%f'
zstyle ':completion:*:warnings' format '%F{red}-- no matches found --%f'
# Zsh options
setopt autocd # Change directory just by typing directory name
setopt extendedglob # Enable extended globbing
setopt no_beep # Disable the bell
setopt correct # Correct common typos
setopt complete_in_word # Complete from the middle of a word
# Load any profile environment variables
if [[ -f /etc/zsh/zprofile ]]; then
source /etc/zsh/zprofile
fi
if [[ -f /etc/zsh/zshrc ]]; then
source /etc/zsh/zshrc
fi
# --- fzf Integration ---
# Load fzf key bindings and completions (Gentoo paths)
if [[ -f "/usr/share/fzf/key-bindings.zsh" ]]; then
source "/usr/share/fzf/key-bindings.zsh"
fi
if [[ -f "/usr/share/fzf/completion.zsh" ]]; then
source "/usr/share/fzf/completion.zsh"
fi
# --- Aliases ---
# General aliases
alias c='clear'
alias df='df -h'
alias du='du -sh'
alias ip='ip -c a'
alias ping='ping -c 5'
alias top='htop'
alias nano='nano -c'
# Add your SSH aliases here
# alias myserver='ssh user@hostname'
# Git aliases
alias g='git'
alias gs='git status'
alias ga='git add .'
alias gc='git commit -m'
alias gp='git push'
alias gl='git log --oneline --decorate --all --graph'
# --- lsd Aliases ---
# Replace ls with lsd for better visuals
alias ls='lsd'
alias l='lsd -F'
alias ll='lsd -l'
alias la='lsd -a'
alias lld='lsd -ld'
alias lla='lsd -la'
alias lt='lsd --tree'
# --- Prompt ---
PROMPT='%n@%m:%~%# '
# Add your VPN function here if using WireGuard/Nebula
# vpn() {
# case "$1" in
# up) sudo wg-quick up <config-name> ;;
# down) sudo wg-quick down <config-name> ;;
# status) sudo wg show <config-name> 2>/dev/null || echo "VPN is down" ;;
# *) echo "Usage: vpn {up|down|status}"; return 1 ;;
# esac
# }
# Neovide wrapper - backgrounds the process and closes terminal
neovide() {
command neovide "$@" &>/dev/null &
disown
exit
}
# Initialize starship prompt
eval "$(starship init zsh)"
# Initialize zoxide (smarter cd)
eval "$(zoxide init zsh)"
export PATH=$PATH:$HOME/.local/bin
# Autosuggestions from history (fish-style)
if [[ -f /usr/share/zsh/site-functions/zsh-autosuggestions.zsh ]]; then
source /usr/share/zsh/site-functions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
bindkey '^[[1;5C' forward-word # Ctrl+Right accept one word
bindkey '^[f' forward-word # Alt+f accept one word (fallback)
fi
# Syntax highlighting (must be at the end)
[[ -f /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh ]] && \
source /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh