131 lines
3.7 KiB
Bash
131 lines
3.7 KiB
Bash
# ~/.zshrc
|
|
|
|
export TERM="xterm-256color"
|
|
|
|
# --- Basic Zsh Configuration ---
|
|
|
|
# Set default editor (for consistency)
|
|
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 (e.g., removal of multiple files)
|
|
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.
|
|
# These files are installed by app-shells/fzf
|
|
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' # Assuming htop is installed (it's in your list)
|
|
alias nano='nano -c' # Show cursor position
|
|
|
|
# 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' # List only files, no directories
|
|
alias ll='lsd -l' # Long format
|
|
alias la='lsd -a' # All files
|
|
alias lld='lsd -ld' # Long format, directories only
|
|
alias lla='lsd -la' # Long format, all files
|
|
alias lt='lsd --tree' # Tree view
|
|
|
|
# Wireguard VPN control function
|
|
vpn() {
|
|
case "$1" in
|
|
up)
|
|
sudo wg-quick up nexus
|
|
;;
|
|
down)
|
|
sudo wg-quick down nexus
|
|
;;
|
|
status)
|
|
sudo wg show nexus 2>/dev/null || echo "VPN is down"
|
|
;;
|
|
*)
|
|
echo "Usage: vpn {up|down|status}"
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Neovide wrapper - automatically 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)
|
|
source /usr/share/zsh/site-functions/zsh-autosuggestions.zsh
|
|
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
|
|
|
# Ctrl+→ accepts one word from autosuggestion
|
|
bindkey '^[[1;5C' forward-word
|
|
|
|
# Syntax highlighting (must be at the end)
|
|
source /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh
|
|
[ -s "/home/damien/.jabba/jabba.sh" ] && source "/home/damien/.jabba/jabba.sh"
|