| # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # SETUP โ install everything this file depends on | |
| # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # Core tools (one line). Run once on a fresh machine: | |
| # | |
| # brew install starship fzf zoxide eza bat | |
| # | |
| # starship โ the prompt | |
| # fzf โ fuzzy finder (Ctrl+R history, Ctrl+T files) | |
| # zoxide โ smart cd (z <partial> jumps to frequent dirs) | |
| # eza โ modern ls (NOT exa, which is unmaintained) | |
| # bat โ cat with syntax highlighting | |
| # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # โโ History โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # 100k entries, shared live across tabs, no duplicates kept. | |
| # SHARE_HISTORY already implies incremental append, so INC_APPEND is dropped. | |
| HISTSIZE=100000 | |
| SAVEHIST=100000 | |
| HISTFILE=~/.zsh_history | |
| setopt SHARE_HISTORY # all open shells read/write the same history live | |
| setopt HIST_IGNORE_ALL_DUPS # drop older duplicate when a new dup is added | |
| setopt HIST_REDUCE_BLANKS # collapse superfluous whitespace before saving | |
| setopt HIST_FIND_NO_DUPS # skip dups when cycling through history search | |
| # โโ Completions โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| # Rebuild the completion dump at most once every 24h instead of every launch. | |
| # -C skips the security check and just loads the cached dump (the fast path). | |
| autoload -Uz compinit | |
| if [[ -n ~/.zcompdump(#qN.mh+24) ]]; then | |
| compinit # cache is stale (older than 24h) -> full rebuild | |
| else | | | compinit -C # cache is fresh -> load without rescanning | | | fi | | | zstyle ':completion:' matcher-list 'm:{a-z}={A-Z}' # case-insensitive matching | | | zstyle ':completion:' menu select # arrow-key menu selection | | | # โโ Cursor movement โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | | | # Option+Arrow jumps by word, Option+Backspace deletes a word. | | | # Two keycode variants because terminals disagree on what they emit. | |
| bindkey '^[[1;3D' backward-word # Option+Left | |
| bindkey '^[[1;3C' forward-word # Option+Right | |
| bindkey '^[^?' backward-kill-word # Option+Backspace | |
| bindkey '^[[1;9D' backward-word # Alt+Left (some terminals) | |
| bindkey '^[[1;9C' forward-word # Alt+Right (some terminals) | |
| # โโ Prompt and shell tooling โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | | | # 2>/dev/null hides errors if a binary is missing, at the cost of silent | | | # breakage. If your prompt ever looks wrong, drop the redirect to see why. | |
| eval "$(starship init zsh)" 2>/dev/null # prompt | |
| eval "$(fzf --zsh)" 2>/dev/null # Ctrl+R fuzzy history, Ctrl+T files | |
| eval "$(zoxide init zsh)" 2>/dev/null # smart cd: `z <partial>` | |
| # โโ Aliases: navigation โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | | | alias ..='cd ..' | | | alias ...='cd ../..' | | | alias ....='cd ../../..' | | | # โโ Aliases: file listing (eza, colorful, dirs first) โโโโโโโโโโโโโโโโ | |
| alias ls='eza --color --group-directories-first' | |
| alias la='eza --color -la --group-directories-first' | |
| alias ll='eza --color -l --group-directories-first' | |
| alias lt='eza --color --tree --level=2' | |
| # โโ Aliases: git โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | | | alias gs='git status' | | | alias gd='git diff' | | | alias gds='git diff --staged' | | | alias ga='git add' | | | alias gaa='git add --all' | | | alias gc='git commit' | | | alias gcm='git commit -m' | | | alias gp='git push' | | | alias gpl='git pull' | | | alias gl='git log --oneline --graph --all' | | | alias gco='git checkout' | | | alias gsw='git switch' | | | alias gb='git branch' | | | alias gst='git stash' | | | alias gstp='git stash pop' | |
| # โโ Aliases: bat (syntax-highlighted cat) โโโโโโโโโโโโโโโโโโโโโโโโโโโโ | |
| alias c='bat --style=plain' | |
| alias b='bat' | | | # โโ Editor โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | | | export EDITOR="nano" | | | export VISUAL="nano" | | | # โโ Locale โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | | | export LANG=en_US.UTF-8 | | | # โโ Quality of life โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ | | | setopt AUTO_CD # type a directory name to cd into it | | | alias path='echo $PATH | tr ":" "\n"' # print PATH one entry per line | | | alias reload='source ~/.zshrc' # re-source after edits | | | alias hosts='sudo nano /etc/hosts' # edit the hosts file |