# vim:ft=zsh:fenc=utf-8:fdm=marker # load starship eval "$(starship init zsh)" ### plugins via antigen {{{ # don't pollute $HOME with antigen ADOTDIR="$HOME/.local/share/antigen" if [[ ! -d "$ADOTDIR" ]]; then mkdir -p "$ADOTDIR" curl -L https://git.io/antigen > "$ADOTDIR/antigen.zsh" chmod +x "$ADOTDIR" fi # load antigen source "$ADOTDIR/antigen.zsh" antigen use oh-my-zsh antigen bundle colored-man-pages antigen bundle colorize antigen bundle docker-compose antigen bundle git antigen bundle gpg-agent antigen bundle kubectl # omz's vi-mode doesn't vibe with starship antigen bundle jeffreytse/zsh-vi-mode antigen bundle greymd/docker-zsh-completion antigen bundle zsh-users/zsh-autosuggestions antigen bundle zsh-users/zsh-completions antigen bundle zsh-users/zsh-syntax-highlighting antigen apply # https://github.com/ohmyzsh/ohmyzsh/issues/10728 if [[ ! -d "$ZSH_CACHE_DIR/completions" ]]; then mkdir -p "$ZSH_CACHE_DIR/completions" fi # }}} ### basics {{{ # history export HISTFILE="$HOME/.zhistory" export HISTSIZE=10000 export SAVEHIST=10000 setopt HIST_IGNORE_ALL_DUPS setopt HIST_IGNORE_DUPS # fuck if available [[ -x "$(command -v thefuck)" ]] && eval $(thefuck --alias) # credit to locotay function bitch() { [ "$1" = "you" ] && [ "$2" = "better" ] && sudo "${@:3}" } # }}} ### aliases & functions {{{ ## basics {{{ # use exa+lsd to list directories, if available, falling back to ls aliases if [ -x "$(command -v lsd)" ] && [ -x "$(command -v exa)" ]; then # add a bit more space between the file icon & name export EXA_ICON_SPACING=1 # lsd is the better drop-in replacement alias ls='lsd' # only exa can do this, atm alias l='exa --icons --group-directories-first' alias ll='exa --icons --group-directories-first --git -l' alias la='exa --icons --group-directories-first --git -la' # only lsd can do this, atm alias lt='lsd -l --total-size' alias lat='lsd -lA --total-size' else alias l='ls' alias ll='ls -l' alias la='ls -lA' fi # use neovim as vim, if installed if [[ -x "$(command -v nvim)" ]]; then alias vim='nvim' # open vimwiki alias wiki='nvim -c VimwikiIndex' fi if [[ -x "$(command -v newsboat)" ]]; then alias nb='newsboat -C ~/.config/newsboat/config -u ~/.config/newsboat/urls' fi [[ -x "$(command -v taskwarrior-tui)" ]] && alias tt='taskwarrior-tui' # switch between yubikeys for the same GPG key alias switch_yubikeys='gpg-connect-agent "scd serialno" "learn --force" /bye' # list tty devices on macOS, useful for Arduino & other boards alias lstty='ls /dev | grep -E "^(tty\.|cu\.)" --color=never' ## }}} ## OS-dependent tweaks {{{ # manage yabai & ecosystem easier function twm() { case "$1" in "start") brew services start skhd brew services start yabai ;; "stop") brew services stop skhd brew services stop yabai ;; "restart") launchctl kickstart -k "gui/${UID}/homebrew.mxcl.skhd" launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai" ;; *) echo "Usage: twm " return 1 ;; esac } alias sbks='launchctl kickstart -k "gui/${UID}/homebrew.mxcl.sketchybar"' alias onefetch='onefetch --true-color=never' function icat() { if [ "$TERM_PROGRAM" = "WezTerm" ]; then wezterm imgcat "$@" elif [ "$TERM" = "xterm-kitty" ]; then kitty +kitten icat "$@" else echo 'No image viewer defined for this terminal' fi } ## }}} ## development {{{ # use the combination of colordiff & diff-so-fancy if [ -x "$(command -v colordiff)" ] && [ -x "$(command -v diff-so-fancy)" ]; then function diff() { colordiff -N -u "$@" | diff-so-fancy } function kdiff() { KUBECTL_EXTERNAL_DIFF="colordiff -N -u" kubectl diff "$@" | diff-so-fancy } fi ## chezmoi alias cma='chezmoi add' alias cmap='chezmoi apply' alias cmcd='cd $(chezmoi source-path)' alias cmd='chezmoi diff' alias cme='chezmoi edit' alias cmm='chezmoi merge' alias cmrm='chezmoi remove' alias cmst='chezmoi status' alias cmup='chezmoi update' ## }}} ### }}} ### languages & frameworks {{{ # python, my old friend if [ -x "$(command -v pyenv)" ]; then eval "$(pyenv init -)" fi # ruby if [ -x "$(command -v rbenv)" ]; then eval "$(rbenv init - zsh)" fi # node [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # }}} ### technical BS {{{ # some bs seting the window title, apparently function set_win_title(){ echo -ne "\033]0;$(basename "$PWD")\007" } precmd_functions+=(set_win_title) # }}}