131 lines
3.5 KiB
Bash
131 lines
3.5 KiB
Bash
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
|
# Initialization code that may require console input (password prompts, [y/n]
|
|
# confirmations, etc.) must go above this block; everything else may go below.
|
|
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
|
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
|
fi
|
|
|
|
# =========================
|
|
# Zsh base / Oh My Zsh
|
|
# =========================
|
|
|
|
export ZSH="$HOME/.oh-my-zsh"
|
|
ZSH_THEME_NEWLINE_BEFORE_PROMPT=false
|
|
ZSH_THEME="bira-nerd"
|
|
|
|
plugins=(
|
|
git
|
|
ssh-agent
|
|
zsh-autosuggestions
|
|
zsh-syntax-highlighting
|
|
zsh-completions
|
|
)
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
# =========================
|
|
# General environment
|
|
# =========================
|
|
|
|
export EDITOR="nvim"
|
|
export VISUAL="nvim"
|
|
|
|
# Better history
|
|
HISTSIZE=50000
|
|
SAVEHIST=50000
|
|
HISTFILE="$HOME/.zsh_history"
|
|
setopt SHARE_HISTORY
|
|
setopt INC_APPEND_HISTORY
|
|
setopt HIST_IGNORE_DUPS
|
|
setopt HIST_IGNORE_ALL_DUPS
|
|
setopt HIST_FIND_NO_DUPS
|
|
setopt HIST_REDUCE_BLANKS
|
|
|
|
# =========================
|
|
# Completion tuning
|
|
# =========================
|
|
|
|
autoload -Uz compinit
|
|
# Speed up compinit by caching, but rebuild if needed
|
|
if [[ -n $ZDOTDIR && -f $ZDOTDIR/.zcompdump || -f ~/.zcompdump ]]; then
|
|
compinit
|
|
else
|
|
compinit -C
|
|
fi
|
|
|
|
zstyle ':completion:*' menu select
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|=*' 'l:|=* r:|=*'
|
|
zstyle ':completion:*' group-name ''
|
|
zstyle ':completion:*:descriptions' format '%F{yellow}-- %d --%f'
|
|
|
|
# =========================
|
|
# Prompt / colors / quality of life
|
|
# =========================
|
|
|
|
# Use modern ls colors
|
|
export LS_COLORS="$LS_COLORS:di=1;34:ln=36:so=35:pi=33:ex=1;32:bd=34;46:cd=34;43:su=37;41:sg=30;43:tw=30;42:ow=34;42"
|
|
|
|
# Aliases
|
|
alias ls='eza --icons --group-directories-first'
|
|
alias ll='eza -lh --icons --group-directories-first --git'
|
|
alias la='eza -lha --icons --group-directories-first --git'
|
|
alias tree='eza --tree --icons'
|
|
alias ..='cd ..'
|
|
alias ...='cd ../..'
|
|
alias grep='grep --color=auto'
|
|
alias c='clear'
|
|
alias please='sudo $(fc -ln -1)'
|
|
|
|
# Pacman helpers (EndeavourOS / Arch)
|
|
alias pacs='sudo pacman -S'
|
|
alias pacr='sudo pacman -Rns'
|
|
alias pacu='sudo pacman -Syu'
|
|
alias yayu='yay -Syu --noconfirm'
|
|
|
|
# Git shortcuts
|
|
alias gs='git status -sb'
|
|
alias gl='git log --oneline --graph --decorate'
|
|
alias gc='git commit'
|
|
alias gco='git checkout'
|
|
alias gp='git push'
|
|
alias gpl='git pull'
|
|
|
|
# =========================
|
|
# Keybindings / history search
|
|
# =========================
|
|
|
|
bindkey -e # emacs-style
|
|
# Up/down search by history based on current input
|
|
autoload -Uz up-line-or-history down-line-or-history
|
|
zle -N up-line-or-history
|
|
zle -N down-line-or-history
|
|
bindkey '^[[A' up-line-or-history
|
|
bindkey '^[[B' down-line-or-history
|
|
|
|
# =========================
|
|
# Autosuggestions & highlighting tweaks
|
|
# =========================
|
|
|
|
# Make autosuggestions subtle
|
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
|
|
|
# Ensure syntax highlighting is loaded last (safety net)
|
|
if [ -f "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then
|
|
source "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
|
fi
|
|
|
|
# =========================
|
|
# Path fixes (non-invasive)
|
|
# =========================
|
|
|
|
# Add user-local bin dirs if they exist
|
|
[[ -d "$HOME/.local/bin" ]] && path=("$HOME/.local/bin" $path)
|
|
[[ -d "$HOME/bin" ]] && path=("$HOME/bin" $path)
|
|
|
|
export PATH
|
|
|
|
source ~/.powerlevel10k/powerlevel10k.zsh-theme
|
|
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
|
|
|
|
# opencode
|
|
export PATH=/home/user/.opencode/bin:$PATH
|