Skip to content

Instantly share code, notes, and snippets.

@markusstrasser
Last active September 7, 2025 15:07
Show Gist options
  • Select an option

  • Save markusstrasser/82ade293162028377de427adb97c61cd to your computer and use it in GitHub Desktop.

Select an option

Save markusstrasser/82ade293162028377de427adb97c61cd to your computer and use it in GitHub Desktop.
ZSHRC
# Show repo summary only when inside a Git repo
if command -v onefetch >/dev/null 2>&1; then
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
onefetch # looks cool
fi
fi
# Make sure shims are discoverable
: ${ZPFX:=${HOME}/.local/share/zinit/polaris}
typeset -gU path; path=("$ZPFX/bin" $path) # add in front
# Fast prompt
setopt PROMPT_SUBST
export HOMEBREW_NO_AUTO_UPDATE=1 # stop brew from updating the world every command
export EDITOR="nvim"
# make dvisvgm find Ghostscript's library (required for PostScript specials)
export LIBGS="/opt/homebrew/lib/libgs.dylib"
# pkg-config search (fix the trailing '?' typo)
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:/opt/homebrew/opt/libffi/lib/pkgconfig"
# Core PATH (most→least important)
export PATH="$HOME/.local/bin:/Users/alien/.bun/bin:/opt/homebrew/bin:/Library/TeX/texbin:$PATH"
export PATH="$HOME/.atuin/bin:$PATH"
export PATH="/Applications/IntelliJ IDEA.app/Contents/MacOS:$PATH"
# Ghostty integration (MUST be first)# [[ -n "$GHOSTTY_RESOURCES_DIR" ]] && source "$GHOSTTY_RESOURCES_DIR/shell-integration/zsh/ghostty-integration"
# Zinit
ZINIT_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/zinit/zinit.git"
[[ ! -d "$ZINIT_HOME" ]] && git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME"
source "$ZINIT_HOME/zinit.zsh"
# Completions setup (before plugins)
autoload -Uz compinit && compinit
# --- AFTER ---
zinit ice wait lucid
zinit light zsh-users/zsh-completions
zinit ice wait lucid
zinit light zsh-users/zsh-autosuggestions
zinit ice wait lucid
zinit light Aloxaf/fzf-tab
zinit ice wait lucid
zinit light hlissner/zsh-autopair
# Fast syntax highlighting should remain last and load synchronously
# to prevent a flash of un-highlighted text.
zinit light zdharma-continuum/fast-syntax-highlighting
# Git tools (pick ONE workflow enhancer)
zinit ice wait lucid
zinit light paulirish/git-open # just 'git open' to view repo in browser
# Better commands
alias ls='eza --icons=always --color=always --group-directories-first --classify'
alias ll='eza -la --icons=always --color=always --git --header --time-style=relative'
alias cat='bat'
alias ga='git add .'
alias gc='git commit -m'
alias gb='git branch --sort=-committerdate | fzf --preview="git log --oneline --graph --color=always {}" | xargs git checkout'
alias g='lazygit'
alias f='fuck'
alias read='glow README.md'
alias gac='git add . && git commit -m'
# Quick Directory Nav
alias p='z ~/Projects'
alias do='z ~/Documents'
alias dl='z ~/Downloads'
#zoxide
alias cd='z'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias v='nvim'
alias vi='nvim'
alias vim='nvim'
alias bu="brew -v update; brew upgrade --force-bottle --cleanup; brew cleanup; brew cask cleanup; brew prune; brew doctor"
alias upall='bu; bun update -g; bun upgrade -g; sudo gem update --system; sudo gem update --no-document'
alias rl='source ~/.zshrc'
alias tree='eza --tree --icons=auto'
alias treed='eza --tree --icons=auto --level'
#show most recent proejcts
# alias pp='z "$(find ~/Projects -maxdepth 1 -type d -not -path ~/Projects -print0 | xargs -0 stat -f "%m %N" | sort -rn | cut -d" " -f2- | fzf --no-sort --preview="ls -la {}" --height=40%)"'
alias uvr='uv cache clean && rm uv.lock && rm -rf .venv && uv sync'
alias pp='z "$(gfind ~/Projects -mindepth 1 -maxdepth 1 -type d -printf "%T@ %p\n" | sort -nr | sd "^[0-9.]+ " "" | fzf --preview "eza --tree --level=2 --icons=always {}")"'
a() {
alias | sed 's/=/\t→ /' | column -t -s $'\t' | fzf
}
export FZF_DEFAULT_OPTS='
--style full
--layout=reverse
--border=rounded
--color=fg:#f8f8f2,bg:#282a36,hl:#bd93f9
--color=fg+:#f8f8f2,bg+:#44475a,hl+:#bd93f9
--color=info:#ffb86c,prompt:#50fa7b,pointer:#ff79c6'
# Override default fzf keybindings for a richer experience.
export FZF_CTRL_T_COMMAND='eza --tree --level=3 --icons=always --color=always --git-ignore'
export FZF_CTRL_T_OPTS="--preview '_fzf_previewer {}'"
export FZF_ALT_C_COMMAND='fd --type d --hidden --follow --exclude .git'
export FZF_ALT_C_OPTS="--preview 'eza --tree --level=2 --icons=always {}'"
browse() {
local dir="${1:-.}"
local default_opener="${2:-nvim}"
default_opener="${default_opener#-}"
gfind "$dir" -maxdepth 3 -type f -printf '%T@ %p\n' | \
sort -nr | \
sd '^[0-9.]* ' '' | \
fzf --preview 'case {} in *.md|*.markdown) bat --color=always --style=header,grid {} ;; *) bat --color=always {} ;; esac' \
--preview-window=right:60% \
--with-nth=-1 --delimiter='/' \
--bind "enter:execute($default_opener {})+abort" \
# --bind "ctrl+o:execute(open -a \"Obsidian\" {})+abort" \
# --bind "ctrl+c:execute(code {})+abort"
}
alias b='browse'
alias bn='browse ~/Documents/notes'
alias bdl='browse ~/Downloads'
alias bdo='browse ~/Documents'
c() {
code \
~/.zshrc \
~/.config/starship.toml \
~/.config/ghostty/config \
~/.config/yazi/yazi.toml \
~/.config/yazi/open.lua \
~/.config/yazi/keymap.toml \
~/.config/nvim/init.lua \
~/.config/nvim/lua/config/lazy.lua \
~/.hammerspoon/init.lua \
~/Library/Application\ Support/Cursor/User/settings.json
}
bdeps() {
brew deps --tree "$1" | less
}
loc() {
tokei "$@" | gum format -t template | gum style --foreground="#ff79c6" --border double
}
y() {
#https://yazi-rs.github.io/docs/quick-start
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && builtin cd -- "$cwd"
rm -f -- "$tmp"
}
uva() {
[[ ! -d .venv ]] && uv venv
source .venv/bin/activate
}
killport() {
lsof -ti:$1 | xargs kill -9
}
bug() {
# Just copy recent terminal output from current session
local lines=${1:-30}
# Use built-in fc (history) + copy visible terminal buffer
fc -ln -$lines | llm "Here's my recent command history. The last command probably failed. Debug and explain the fix. Be direct."
}
# Better bat theme
export BAT_THEME="Dracula" # or "TwoDark", "gruvbox-dark"
# Completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':fzf-tab:*' fzf-preview 'eza -1 --icons=auto --color=always $realpath 2>/dev/null || echo $desc'
zstyle ':completion:*:git-checkout:*' sort false
# History (atuin handles this better than built-in)
eval "$(atuin init zsh --disable-up-arrow)" # ctrl-r only, preserve up arrow
# Prompt (Starship)
eval "$(starship init zsh)"
# Quick inits
eval "$(zoxide init zsh)"
# # SDKMAN (must be last)
# export SDKMAN_DIR="$HOME/.sdkman"
# [[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment