|
# ============================================ |
|
# Minimal zsh Configuration |
|
# ============================================ |
|
|
|
# --- Basic zsh settings --- |
|
setopt AUTO_CD # Type directory name to cd into it |
|
setopt HIST_IGNORE_DUPS # Don't save duplicate commands in history |
|
setopt SHARE_HISTORY # Share history across all terminals |
|
HISTFILE=~/.zsh_history |
|
HISTSIZE=10000 |
|
SAVEHIST=10000 |
|
|
|
# --- Enable completion system --- |
|
autoload -Uz compinit |
|
compinit |
|
|
|
# --- Git alias completions --- |
|
# When adding a new git alias above, add a corresponding compdef line here |
|
# This enables git-aware tab completion for each alias |
|
compdef _git gs=git-status |
|
compdef _git gf=git-fetch |
|
compdef _git gc=git-checkout |
|
compdef _git gl=git-log |
|
compdef _git gup=git-push |
|
compdef _git gu=git-submodule |
|
compdef _git gst=git-stash |
|
compdef _git gwhere=git-remote |
|
compdef _git git-discard=git-reset |
|
compdef _git gst-export=git-stash |
|
|
|
# --- Initialize Starship Prompt --- |
|
eval "$(starship init zsh)" |
|
|
|
# --- Syntax Highlighting --- |
|
if [ -f ~/.zsh-plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh ]; then |
|
source ~/.zsh-plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh |
|
fi |
|
|
|
# --- Git Command Shortcuts --- |
|
alias gs='git status' |
|
alias gf='git fetch -p' |
|
alias gc='git checkout' |
|
alias gl='git log --oneline' |
|
alias gup='git push -u origin' |
|
alias gu='git submodule update --init --recursive' |
|
alias gst='git stash' |
|
alias gst-export='git stash show stash@{0} -p > changes.patch' |
|
alias git-discard='git reset --hard @{u}' |
|
alias gwhere='git remote -v' |
|
alias gprune='!git fetch -p && git branch -vv | awk '/: gone]/{print \$1}' | xargs -r git branch -d' |
|
|
|
# Git help - show all git aliases |
|
alias git-help='cat << "EOF" |
|
Git Aliases: |
|
--------------------------------------------------------------- |
|
gs git status |
|
gf git fetch -p (prune stale branches) |
|
gc git checkout |
|
gl git log --oneline |
|
gup git push -u origin (set upstream and push) |
|
gu git submodule update --init --recursive |
|
gst git stash |
|
gst-export git stash show stash@{0} -p > changes.patch |
|
git-discard git reset --hard @{u} (discard local changes) |
|
gwhere git remote -v (show remotes) |
|
gprune git branch -vv | awk "/: gone]/{print \$1}" | xargs -r git branch -d (delete all stale branches locally) |
|
--------------------------------------------------------------- |
|
EOF |
|
' |
|
|
|
# --- Add local bin to PATH --- |
|
export PATH="$HOME/.local/bin:$PATH" |
|
export EDITOR="zed --wait" |
|
export VISUAL="zed --wait" |