Files
dotfiles/zsh/.zshrc
Thomas Naderer d8a20d620a chore: clean up dotfiles and add gitignore whitelist
Switch to whitelist-based .gitignore to only track essential configs:
nvim, yazi, kitty, zsh, ideavim, karabiner, tmux, scripts, starship.
Remove history, compiled files, and plugin dirs from tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 12:57:14 +01:00

164 lines
5.7 KiB
Bash

# vim:fileencoding=utf-8:foldmethod=marker
# Enable Powerlevel10k instant prompt {{{
# Loads the instant prompt to make the shell feel fast (part of powerlevel10k)
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
POWERLEVEL9K_INSTANT_PROMPT=quiet # run instant prompt quietly
# Fix for tmux compatibility
[[ $TERM == "tmux-256color" ]] && export TERM_PROGRAM="kitty"
# }}}
# Environment variables {{{
export MYVIMRC="$HOME/.config/nvim/init.lua" # define MYVIMRC variable so you can use $MYVIMRC to access your init.lua
export MANPAGER="nvim +Man!"
## Use IINA CLI
export YTFZF_PLAYER="iina"
# Doom Emacs
export PATH="$HOME/.emacs.d/bin:$PATH"
# }}}
# # ~/.config/secrets/.env
for f in ~/.config/secrets/.env; do
export $(grep -v '^#' "$f" | xargs)
done
# Prompt engine toggle {{{
# 1 = Starship, 0 = Powerlevel10k
export USE_STARSHIP=1
# }}}
# Load Oh My Zsh {{{
export ZSH="$XDG_CONFIG_HOME/.oh-my-zsh" # set path to Oh My Zsh
if [[ "$USE_STARSHIP" == "1" ]]; then
ZSH_THEME="" # disable OMZ theme when using starship
else
ZSH_THEME="powerlevel10k/powerlevel10k"
fi
source $ZSH/oh-my-zsh.sh # load Oh My Zsh framework (plugins, completions, themes)
# }}}
# Theme and prompt {{{
if [[ "$USE_STARSHIP" == "1" ]]; then
eval "$(starship init zsh)"
else
source $XDG_CONFIG_HOME/p10k/.p10k.zsh # load Powerlevel10k configuration
fi
# }}}
# ZSH Plugins {{{
plugins=(git zsh-autosuggestions zsh-syntax-highlighting) # enable git support, autosuggestions and syntax highlighting
eval "$(zoxide init zsh)" # enable zoxide for fast directory jumping
# }}}
# Keybindings {{{
bindkey -v # enable vi-style keybindings
export KEYTIMEOUT=1 # make ESC faster when using vi keybindings
# Fix backspace for SSH connections
# bindkey "^?" backward-delete-char
# bindkey "^H" backward-delete-char
# }}}
# Aliases and Functions {{{
alias openclaw='/Users/thomasnaderer/.nvm/versions/node/v22.22.0/bin/node /Users/thomasnaderer/.nvm/versions/node/v22.22.0/bin/openclaw'
openclaw_tui() {
local token
token="$(jq -r '.gateway.auth.token // empty' "$HOME/.openclaw/openclaw.json" 2>/dev/null)"
if [ -z "$token" ]; then
echo "openclaw_tui: missing gateway token in ~/.openclaw/openclaw.json"
return 1
fi
OPENCLAW_GATEWAY_TOKEN="$token" openclaw tui --token "$token" "$@"
}
alias octui='openclaw_tui'
alias wfy="ssh ftp5794822\@www76.world4you.com"
alias h="cd ~" # go to home folder
alias f="open ." # open current folder in Finder
alias cl="clear" # clear terminal screen
alias tnh="cd /Volumes/AK127132" # quick cd to mounted volume AK127132
alias tni="cd /Volumes/ipec/intern" # quick cd to mounted volume intern
alias l='eza --color=always --icons -la --group-directories-first' # fancy ls with icons and sorting
alias n='nvim' # shortcut for Neovim
alias m='neomutt' # open Neomutt mail client
alias tm='tmux' # open Tmux Terminal Multiplexer
# Quick Access to Config Files
alias ne='nvim ~/.zshenv' # edit global zshenv
alias nz='nvim ~/.config/zsh/.zshrc' # edit this zshrc
alias nni='nvim ~/.config/nvim/init.lua' # edit Neovim init.lua
alias sni='source ~/.config/nvim/init.lua' # source Neovim init.lua
alias nnp='nvim ~/.config/nvim/lua/plugins/init.lua' # edit main plugins file
alias nnk='nvim ~/.config/nvim/lua/keymaps.lua' # edit keymaps.lua
alias nns='nvim ~/.config/nvim/lua/settings.lua' # edit settings.lua
alias ny='nvim ~/.config/yazi/yazi.toml' # edit Yazi config
alias nyk='nvim ~/.config/yazi/keymap.toml' # edit Yazi keymap config
alias nk='nvim ~/.config/kitty/kitty.conf' # edit Kitty terminal config
alias nkk='nvim ~/.config/kitty/keymap.conf' # edit Kitty keymap config
alias ntc='nvim ~/.config/tmux/tmux.conf' # edit Kitty keymap config
# Git
alias g='git' # shorthand for git
alias gs='git status' # git status
alias gc='git commit' # git commit
alias gt='git log --oneline --graph --decorate --all' # git log in graph(tree) format
alias lg='lazygit' # open Lazygit
# Docker
alias ld='lazydocker' # open Lazydocker
# Scripts
alias mnt='sh $HOME/.config/scripts/tnmount.sh' # run tnmount.sh script
# Custom Functions
# Start yazi with "y", and when you quit yazi, your shell will "cd" to the folder you navigated to in yazi
function y() {
local tmp="/tmp/yazi-cwd-$$"
yazi "$@" --cwd-file="$tmp"
if [ -f "$tmp" ]; then
local cwd="$(cat "$tmp")"
if [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd "$cwd"
fi
fi
rm -f "$tmp"
}
# }}}
# Conda initialize {{{
# export PATH="/opt/homebrew/anaconda3/bin:$PATH" # commented out by conda initialize
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup" # conda properly initialized
else
if [ -f "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" # fallback to sourcing conda profile
else
export PATH="/opt/homebrew/anaconda3/bin:$PATH" # fallback: manually add conda to path
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# }}}
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
# fzf + fd integration
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# fzf shell integration (keybindings + completion)
eval "$(fzf --zsh)"