From dd2e773aae5360c16a9ba9192f5adb2f5b8921a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 10:49:58 +0100 Subject: [PATCH 01/10] chore(zsh): remove unused macos config --- zsh/.zprofile | 1 - zsh/.zsh_plugins_darwin.txt | 1 - zsh/.zshenv | 11 ----------- zsh/.zshrc | 17 +---------------- zsh/aliases.zsh | 14 +------------- zsh/scripts.zsh | 12 +----------- 6 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 zsh/.zsh_plugins_darwin.txt diff --git a/zsh/.zprofile b/zsh/.zprofile index 33d3a19..8b13789 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1,2 +1 @@ -export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/neovim/bin:$HOME/bin:${PATH}" diff --git a/zsh/.zsh_plugins_darwin.txt b/zsh/.zsh_plugins_darwin.txt deleted file mode 100644 index 7007731..0000000 --- a/zsh/.zsh_plugins_darwin.txt +++ /dev/null @@ -1 +0,0 @@ -lukechilds/zsh-nvm diff --git a/zsh/.zshenv b/zsh/.zshenv index 09af955..55552e8 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -7,17 +7,6 @@ export XDG_STATE_HOME="$HOME/.local/state" # ~/.local/bin export PATH="$HOME/.local/bin:$PATH" -# brew sbin -export PATH="/opt/homebrew/sbin:$PATH" - -# brew lib -export LIBRARY_PATH="$LIBRARY_PATH:/opt/homebrew/lib" - -# cargo -if [[ "$OSTYPE" == "darwin"* ]]; then - source "$HOME/.cargo/env" -fi - # language environment export LANG=en_US.UTF-8 diff --git a/zsh/.zshrc b/zsh/.zshrc index 713fb81..9103051 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -12,21 +12,8 @@ export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline" source $ZDOTDIR/.antidote/antidote.zsh antidote load -if [[ "$OSTYPE" == "darwin"* ]]; then - antidote load ${ZDOTDIR:-~}/.zsh_plugins_darwin.txt -fi - unsetopt autocd -if [[ "$OSTYPE" == "darwin"* ]]; then - eval "$(pyenv init - zsh)" - eval "$(pyenv virtualenv-init - zsh)" -fi - -if [[ "$OSTYPE" == "darwin"* ]]; then - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) -fi - # ggman eval "$(ggman shellrc)" @@ -40,7 +27,5 @@ autoload -Uz compinit compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION zstyle ':completion:*' cache-path $XDG_CACHE_HOME/zsh/zcompcache -# opam configuration -# [[ ! -r /Users/janezicmatej/.opam/opam-init/init.zsh ]] || source /Users/janezicmatej/.opam/opam-init/init.zsh > /dev/null 2> /dev/null - eval "$(starship init zsh)" +eval "$(direnv hook zsh)" diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index a98ecd1..677fcbd 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,12 +1,7 @@ alias z="exec zsh" alias t=tmux_attach -if [[ "$OSTYPE" == "darwin"* ]]; then - alias n=nvim_ve - alias vim=nvim_ve -elif [[ "$OSTYPE" == "linux"* ]]; then - alias n=nvim -fi +alias n=nvim alias s="ssh-menu" @@ -16,13 +11,8 @@ alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'" # navigation alias cdgit="cd $GGROOT" -alias icloud="cd $HOME/Library/Mobile\ Documents/com\~apple\~CloudDocs" alias temp="cd $HOME/Desktop/temp" -# apple specific -alias accenton="defaults write -g ApplePressAndHoldEnabled -bool true" -alias accentoff="defaults write -g ApplePressAndHoldEnabled -bool false" - # git alias gpo="git push origin" alias gros="git reset origin/$(git_current_branch) --soft" @@ -33,8 +23,6 @@ alias glogaa="git log --oneline --graph --all --pretty=format:\"%C(auto)%h %C(bl alias ci="glab ci list" alias bm=batman alias grow="~/.local/bin/cbonsai -liWC -M 15 -t 2 -w 60 -s $(date +%s)" -alias clean_ds_store='find . -name ".DS_Store" -type f -delete -print' - # ruff alias ruffme="ruff check --fix && ruff format" diff --git a/zsh/scripts.zsh b/zsh/scripts.zsh index db488f8..7aff897 100644 --- a/zsh/scripts.zsh +++ b/zsh/scripts.zsh @@ -1,13 +1,3 @@ -function nvim_ve { - if [[ -e $VIRTUAL_ENV && -f "$VIRTUAL_ENV/bin/activate" ]]; then - source "$VIRTUAL_ENV/bin/activate" - command nvim $@ - deactivate - else - command nvim $@ - fi -} - function afm { RES=$(curl -s "https://$1/api/monitoring/requirements") COUNT=$(echo "$RES" | grep -c $2) @@ -57,7 +47,7 @@ function lh { PORT=$1 fi - open "http://localhost:$PORT" + xdg-open "http://localhost:$PORT" } function dps { From f9ae12962da3f9f8f2e03e7394dc0bd79f8e2c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 10:54:05 +0100 Subject: [PATCH 02/10] chore(zsh): remove unused zsh aliases and scripts --- zsh/aliases.zsh | 8 ------ zsh/scripts.zsh | 70 ------------------------------------------------- 2 files changed, 78 deletions(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 677fcbd..be55e56 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -11,7 +11,6 @@ alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'" # navigation alias cdgit="cd $GGROOT" -alias temp="cd $HOME/Desktop/temp" # git alias gpo="git push origin" @@ -19,12 +18,5 @@ alias gros="git reset origin/$(git_current_branch) --soft" alias gcan="git commit -v --amend --no-edit" alias glogaa="git log --oneline --graph --all --pretty=format:\"%C(auto)%h %C(blue)(%aL/%cL)%C(auto)%(decorate) %s%Creset\"" -# unsorted -alias ci="glab ci list" -alias bm=batman -alias grow="~/.local/bin/cbonsai -liWC -M 15 -t 2 -w 60 -s $(date +%s)" # ruff alias ruffme="ruff check --fix && ruff format" - -# clipboard -alias xcp="xclip -selection c" diff --git a/zsh/scripts.zsh b/zsh/scripts.zsh index 7aff897..5dc979e 100644 --- a/zsh/scripts.zsh +++ b/zsh/scripts.zsh @@ -1,73 +1,3 @@ -function afm { - RES=$(curl -s "https://$1/api/monitoring/requirements") - COUNT=$(echo "$RES" | grep -c $2) - if [[ $COUNT -ge 0 ]]; then - VER=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).version') - # OP=$(echo "$RES" | jq '.[] | select(.name | contains("'"$2"'")).requirement?[0][0]') - # echo "$2""$(echo "$OP" | tr -d '"')""$(echo "$VER" | tr -d '"')" - echo "${2}==$(echo "$VER" | tr -d '"')" - fi -} - -function nukepip { - pip uninstall $(pip freeze) -y - pip install -r $(pyenv root)/default-packages -} - -function pyinit { - if [[ -f .python-version ]]; then - echo "found .python-version, stopping" - return - fi - - DIRNAME=$(basename "$PWD") - - if [[ $(pyenv versions | grep -E "/${DIRNAME}$") ]]; then - echo "found existing version with this name, setting..." - pyenv local "$DIRNAME" - return - fi - - if [[ -z $1 ]]; then - echo "no python version provided, defaulting to $(pyenv version-name)" - VERSION=$(pyenv version-name) - else - VERSION=$1 - fi - - pyenv virtualenv "$VERSION" "$DIRNAME" - pyenv local "$DIRNAME" - -} - -function lh { - if [[ -z $1 ]]; then - PORT=7999 - else - PORT=$1 - fi - - xdg-open "http://localhost:$PORT" -} - -function dps { - if [[ -z $1 ]]; then - docker ps --format table'{{ .ID }}\t{{ .Image }}\t{{ .Ports}}\t{{ .Names }}' - else - docker ps --format table'{{ .ID }}\t{{ .Image }}\t{{ .Ports}}\t{{ .Names }}' | grep $1 - fi -} - -function tssh { - if [[ -z $1 ]]; then - echo "provide ssh host" - return - fi - - ssh -t "$@" "command -v tmux && (tmux a || tmux new-session -s gorazd -c ~) || bash" -} - - function tmux_attach { tmux_running=$(pgrep tmux) From 7829980f8faa8e90161cd87f7b4b3ed2611df293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 11:04:27 +0100 Subject: [PATCH 03/10] chore(zsh): remove remaining dead config --- zsh/.zshenv | 24 ------------------------ zsh/get-dump | 51 --------------------------------------------------- 2 files changed, 75 deletions(-) delete mode 100755 zsh/get-dump diff --git a/zsh/.zshenv b/zsh/.zshenv index 55552e8..c9d1d77 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -7,9 +7,6 @@ export XDG_STATE_HOME="$HOME/.local/state" # ~/.local/bin export PATH="$HOME/.local/bin:$PATH" -# language environment -export LANG=en_US.UTF-8 - # editor export EDITOR=nvim @@ -21,27 +18,6 @@ export PATH="$GOPATH/bin:$PATH" # ggman export GGROOT="$HOME/git" -# neovim -export PATH="$XDG_DATA_HOME/neovim/bin:$PATH" - -# pyenv -export PYENV_ROOT="$XDG_DATA_HOME/.pyenv" -command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" - -# pyenv-virtualenv -# leave python promt to starship -export PYENV_VIRTUALENV_DISABLE_PROMPT=1 - -# poetry -export POETRY_HOME="$XDG_DATA_HOME/poetry" -command -v poetry >/dev/null || export PATH="$POETRY_HOME/bin:$PATH" - -# gnupg -export GPG_TTY=$(tty) - -# aflabs -export USER_UID=$(id -u) -export USER_GID=$(id -g) # name export NAME="Matej Janežič" diff --git a/zsh/get-dump b/zsh/get-dump deleted file mode 100755 index 6dd2a63..0000000 --- a/zsh/get-dump +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -function get-dump { - if [[ -z $1 ]]; then - host="$(rg -N --no-heading 'Host .*' ~/.ssh \ - | sed 's/Host \(.*\)/\1/' \ - | fzf --cycle \ - --bind 'tab:toggle-up,btab:toggle-down' \ - --delimiter ':' \ - --with-nth 2 \ - --header "Navigate with ARROW KEYS or TAB/S-TAB. Select with ENTER." \ - --border "double" \ - --border-label "get-dump" \ - --ansi \ - --highlight-line \ - | cut -d ":" -f2 - )" - if [[ -z $host ]]; then - return - fi - else - host=$1 - fi - - selected=$(ssh "$host" docker ps --format "{{.Names}}" \ - | fzf --cycle \ - --bind 'tab:toggle-up,btab:toggle-down' \ - --header "Navigate with ARROW KEYS or TAB/S-TAB. Select with ENTER." \ - --border "double" \ - --border-label "get-dump" \ - --ansi \ - --highlight-line \ - ) - - if [[ -z $selected ]]; then - echo "not provided" - return - fi - - if ! [[ -d "./dumps" ]]; then - mkdir "./dumps" - fi - - location="./dumps/${host}_${selected}_$(date +'%s')" - - echo "dumping to $location" - - ssh "$host" docker exec "$selected" pg_dump -U db --format=c db >"$location" -} - -get-dump "$@" From d92857428e43a0717fc0d283cec999e4aa7adfdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 12:08:23 +0100 Subject: [PATCH 04/10] feat(zsh): idiomatically organise .zprofile .zshenv and .zshrc --- zsh/.zprofile | 6 +++++- zsh/.zshenv | 8 +++----- zsh/.zshrc | 24 +++++++++++++----------- zsh/aliases.zsh | 4 ++-- zsh/scripts.zsh | 5 +++-- 5 files changed, 26 insertions(+), 21 deletions(-) diff --git a/zsh/.zprofile b/zsh/.zprofile index 8b13789..680433b 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1 +1,5 @@ - +path=( + "$HOME/.local/bin" + "$GOPATH/bin" + $path +) diff --git a/zsh/.zshenv b/zsh/.zshenv index c9d1d77..5460e20 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -4,8 +4,8 @@ export XDG_CACHE_HOME="$HOME/.cache" export XDG_DATA_HOME="$HOME/.local/share" export XDG_STATE_HOME="$HOME/.local/state" -# ~/.local/bin -export PATH="$HOME/.local/bin:$PATH" +# deduplicate path +typeset -U path # editor export EDITOR=nvim @@ -13,14 +13,12 @@ export EDITOR=nvim # go export GOPATH="$XDG_DATA_HOME/go" export GOMODCACHE="$XDG_CACHE_HOME/go/mod" -export PATH="$GOPATH/bin:$PATH" # ggman export GGROOT="$HOME/git" - # name export NAME="Matej Janežič" -# starship nest config into a folder, default is ~/.config/startship.toml +# starship nest config into a folder, default is ~/.config/starship.toml export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml" diff --git a/zsh/.zshrc b/zsh/.zshrc index 9103051..75a6028 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,15 +1,17 @@ -# zsh history file -export HISTFILE="$XDG_STATE_HOME/zsh/history" -export HISTSIZE=100 +# zsh history file +HISTFILE="$XDG_STATE_HOME/zsh/history" +HISTSIZE=10000 +SAVEHIST=10000 + +# gnupg +export GPG_TTY=$(tty) ## pre plugin load -# nvm -export NVM_COMPLETION=true -# zsh autosugestions -export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline" +# zsh autosuggestions +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline" # source antidote -source $ZDOTDIR/.antidote/antidote.zsh +source "$ZDOTDIR/.antidote/antidote.zsh" antidote load unsetopt autocd @@ -22,10 +24,10 @@ source "$ZDOTDIR/aliases.zsh" source "$ZDOTDIR/scripts.zsh" # completion -fpath=($ZDOTDIR/completions $fpath) +fpath=("$ZDOTDIR/completions" $fpath) autoload -Uz compinit -compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION -zstyle ':completion:*' cache-path $XDG_CACHE_HOME/zsh/zcompcache +compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" +zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache" eval "$(starship init zsh)" eval "$(direnv hook zsh)" diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index be55e56..6abab72 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -10,11 +10,11 @@ alias dp="docker ps --format 'table {{.Names}}\t{{.Ports}}'" alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'" # navigation -alias cdgit="cd $GGROOT" +alias cdgit='cd $GGROOT' # git alias gpo="git push origin" -alias gros="git reset origin/$(git_current_branch) --soft" +gros() { git reset "origin/$(git_current_branch)" --soft } alias gcan="git commit -v --amend --no-edit" alias glogaa="git log --oneline --graph --all --pretty=format:\"%C(auto)%h %C(blue)(%aL/%cL)%C(auto)%(decorate) %s%Creset\"" diff --git a/zsh/scripts.zsh b/zsh/scripts.zsh index 5dc979e..7225c0b 100644 --- a/zsh/scripts.zsh +++ b/zsh/scripts.zsh @@ -1,10 +1,11 @@ function tmux_attach { + local tmux_running tmux_running=$(pgrep tmux) - if ! [[ -z ${TMUX} ]]; then + if [[ -n ${TMUX} ]]; then echo "already attached; refreshing env" source <(tmux show-environment | sed -n 's/^\(.*\)=\(.*\)$/export \1="\2"/p') - return 1 + return 0 fi if [[ -z $tmux_running ]]; then From 2d371d66d01af1097348a7ddcd5d6a1972190d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 13:07:19 +0100 Subject: [PATCH 05/10] feat(zsh): harden history settings --- zsh/.zshrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 75a6028..8944320 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,7 +1,11 @@ -# zsh history file +# history HISTFILE="$XDG_STATE_HOME/zsh/history" HISTSIZE=10000 SAVEHIST=10000 +setopt HIST_IGNORE_DUPS # skip consecutive duplicates +setopt HIST_IGNORE_SPACE # skip commands starting with space +setopt SHARE_HISTORY # share history across sessions +setopt HIST_REDUCE_BLANKS # strip extra whitespace # gnupg export GPG_TTY=$(tty) From b1cbd7b1fa4a732dc928ab6943c43b2bc3f992a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 13:08:29 +0100 Subject: [PATCH 06/10] feat(zsh): enable sensible shell options --- zsh/.zshrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 8944320..5c460d1 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -18,7 +18,12 @@ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline" source "$ZDOTDIR/.antidote/antidote.zsh" antidote load -unsetopt autocd +# shell options +unsetopt autocd # don't cd into directories by name +setopt NO_BEEP # no terminal bell +setopt AUTO_PUSHD # cd pushes to directory stack +setopt PUSHD_IGNORE_DUPS # no duplicates in directory stack +setopt EXTENDED_GLOB # enable extended glob operators (#, ~, ^) # ggman eval "$(ggman shellrc)" From 6582a55df95662a7fc612a16f0968d7162766691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 13:28:47 +0100 Subject: [PATCH 07/10] feat(zsh): drop ohmyzsh+git for custom aliases --- zsh/.zsh_plugins.txt | 10 ++------ zsh/aliases.zsh | 54 ++++++++++++++++++++++++++++++++++++++++---- zsh/scripts.zsh | 17 ++++++++++++++ 3 files changed, 69 insertions(+), 12 deletions(-) diff --git a/zsh/.zsh_plugins.txt b/zsh/.zsh_plugins.txt index acca4cd..4d4f518 100644 --- a/zsh/.zsh_plugins.txt +++ b/zsh/.zsh_plugins.txt @@ -1,11 +1,5 @@ -# set up Zsh completions with plugins -# mattmc3/ez-compinit +# completions zsh-users/zsh-completions kind:fpath path:src -# frameworks like oh-my-zsh are supported -getantidote/use-omz # handle OMZ dependencies -ohmyzsh/ohmyzsh path:lib # load OMZ's library -ohmyzsh/ohmyzsh path:plugins/git - -# popular fish-like plugins +# fish-like plugins zsh-users/zsh-autosuggestions diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 6abab72..150853c 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -12,11 +12,57 @@ alias dcp="docker compose ps --format 'table {{.Name}}\t{{.Ports}}'" # navigation alias cdgit='cd $GGROOT' -# git -alias gpo="git push origin" -gros() { git reset "origin/$(git_current_branch)" --soft } -alias gcan="git commit -v --amend --no-edit" +# git status/diff +alias gst="git status" +alias gd="git diff" +alias gds="git diff --staged" +alias gdup="git diff @{upstream}" +alias glog="git log --oneline --decorate --graph" +alias gloga="git log --oneline --decorate --graph --all" alias glogaa="git log --oneline --graph --all --pretty=format:\"%C(auto)%h %C(blue)(%aL/%cL)%C(auto)%(decorate) %s%Creset\"" +# git staging/commit +alias ga="git add" +alias gc="git commit -v" +alias gc!="git commit -v --amend" +alias gcan="git commit -v --amend --no-edit" +alias gcan!="git commit -v --all --no-edit --amend" +alias grs="git restore" + +# git branch/checkout +alias gb="git branch" +alias gco="git checkout" +alias gcm='git checkout $(git_main_branch)' +alias gsw="git switch" + +# git fetch/pull/push +alias gfa="git fetch --all --prune" +alias gl="git pull" +alias gp="git push" +alias gpf="git push --force-with-lease" +alias gpf!="git push --force" +alias gpo="git push origin" + +# git rebase +alias grb="git rebase" +alias grba="git rebase --abort" +alias grbc="git rebase --continue" +alias grbi="git rebase -i" +grbm() { git rebase "$(git_main_branch)" } + +# git merge +alias gm="git merge" +alias gma="git merge --abort" +alias gmc="git merge --continue" + +# git cherry-pick +alias gcp="git cherry-pick" +alias gcpa="git cherry-pick --abort" +alias gcpc="git cherry-pick --continue" + +# git stash/reset +alias gstp="git stash pop" +gros() { git reset "origin/$(git_current_branch)" --soft } + # ruff alias ruffme="ruff check --fix && ruff format" diff --git a/zsh/scripts.zsh b/zsh/scripts.zsh index 7225c0b..8d3446d 100644 --- a/zsh/scripts.zsh +++ b/zsh/scripts.zsh @@ -1,3 +1,20 @@ +# git helpers for aliases +function git_current_branch { + command git rev-parse --abbrev-ref HEAD 2>/dev/null +} + +function git_main_branch { + command git rev-parse --git-dir &>/dev/null || return + local ref + for ref in refs/{heads,remotes/{origin,upstream}}/{main,master,trunk}; do + if command git show-ref -q --verify "$ref"; then + echo ${ref:t} + return 0 + fi + done + echo main +} + function tmux_attach { local tmux_running tmux_running=$(pgrep tmux) From ed4e8cabe9d2ba3bae88efc4569aa698f128b5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 13:35:28 +0100 Subject: [PATCH 08/10] feat(zsh): harden completion setup --- .gitignore | 2 -- zsh/.zshrc | 12 ++++++++++-- zsh/completions/.keep | 0 3 files changed, 10 insertions(+), 4 deletions(-) delete mode 100644 zsh/completions/.keep diff --git a/.gitignore b/.gitignore index 6ba475c..79421c7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,7 @@ zsh/* !zsh/.zsh_plugins*.txt !zsh/scripts.zsh !zsh/aliases.zsh -!zsh/completions/.keep !zsh/ssh-menu -!zsh/get-dump # starship !starship diff --git a/zsh/.zshrc b/zsh/.zshrc index 5c460d1..1f2f0fe 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -33,10 +33,18 @@ source "$ZDOTDIR/aliases.zsh" source "$ZDOTDIR/scripts.zsh" # completion -fpath=("$ZDOTDIR/completions" $fpath) +fpath=("$XDG_DATA_HOME/zsh/completions" $fpath) autoload -Uz compinit -compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" +# only regenerate dump once per day +local _zcompdump="$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" +if [[ -n $_zcompdump(#qN.mh+24) ]]; then + compinit -d "$_zcompdump" +else + compinit -C -d "$_zcompdump" +fi zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache" +zstyle ':completion:*' menu select +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' eval "$(starship init zsh)" eval "$(direnv hook zsh)" diff --git a/zsh/completions/.keep b/zsh/completions/.keep deleted file mode 100644 index e69de29..0000000 From 0e54db0eaef73aa2eb207e4f02dc58b5ded02cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 13:41:26 +0100 Subject: [PATCH 09/10] feat(zsh): drop antigen for simple bootstrap --- zsh/.zsh_plugins.txt | 5 ----- zsh/.zshrc | 32 ++++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) delete mode 100644 zsh/.zsh_plugins.txt diff --git a/zsh/.zsh_plugins.txt b/zsh/.zsh_plugins.txt deleted file mode 100644 index 4d4f518..0000000 --- a/zsh/.zsh_plugins.txt +++ /dev/null @@ -1,5 +0,0 @@ -# completions -zsh-users/zsh-completions kind:fpath path:src - -# fish-like plugins -zsh-users/zsh-autosuggestions diff --git a/zsh/.zshrc b/zsh/.zshrc index 1f2f0fe..ec9cf65 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -10,13 +10,33 @@ setopt HIST_REDUCE_BLANKS # strip extra whitespace # gnupg export GPG_TTY=$(tty) -## pre plugin load -# zsh autosuggestions -ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline" +# plugins +local _plugins="$XDG_DATA_HOME/zsh/plugins" +local _stamp="$XDG_CACHE_HOME/zsh/plugins-updated" +local _repos=( + "https://github.com/zsh-users/zsh-completions" + "https://github.com/zsh-users/zsh-autosuggestions" +) +local _needs_update=0 -# source antidote -source "$ZDOTDIR/.antidote/antidote.zsh" -antidote load +if [[ ! -f "$_stamp" ]] || [[ -n $_stamp(#qN.mh+168) ]]; then + mkdir -p "${_stamp:h}" + touch "$_stamp" + _needs_update=1 +fi + +for _repo in $_repos; do + if [[ ! -d "$_plugins/${_repo:t}" ]]; then + git clone "$_repo" "$_plugins/${_repo:t}" + elif (( _needs_update )); then + git -C "$_plugins/${_repo:t}" pull --quiet & + fi +done +(( _needs_update )) && wait + +fpath=("$_plugins/zsh-completions/src" $fpath) +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline" +source "$_plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" # shell options unsetopt autocd # don't cd into directories by name From dbc32cf3737e44ba84a3cb8f1a12511b640add29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Mon, 9 Mar 2026 13:47:34 +0100 Subject: [PATCH 10/10] chore(zsh): idiomatic order for .zshrc --- .gitignore | 1 - zsh/.zshrc | 27 +++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 79421c7..0c697b3 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ zsh/* !zsh/.zshrc !zsh/.zshenv !zsh/.zprofile -!zsh/.zsh_plugins*.txt !zsh/scripts.zsh !zsh/aliases.zsh !zsh/ssh-menu diff --git a/zsh/.zshrc b/zsh/.zshrc index ec9cf65..3d28e77 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,3 +1,10 @@ +# shell options +unsetopt autocd # don't cd into directories by name +setopt NO_BEEP # no terminal bell +setopt AUTO_PUSHD # cd pushes to directory stack +setopt PUSHD_IGNORE_DUPS # no duplicates in directory stack +setopt EXTENDED_GLOB # enable extended glob operators (#, ~, ^) + # history HISTFILE="$XDG_STATE_HOME/zsh/history" HISTSIZE=10000 @@ -7,9 +14,6 @@ setopt HIST_IGNORE_SPACE # skip commands starting with space setopt SHARE_HISTORY # share history across sessions setopt HIST_REDUCE_BLANKS # strip extra whitespace -# gnupg -export GPG_TTY=$(tty) - # plugins local _plugins="$XDG_DATA_HOME/zsh/plugins" local _stamp="$XDG_CACHE_HOME/zsh/plugins-updated" @@ -38,17 +42,7 @@ fpath=("$_plugins/zsh-completions/src" $fpath) ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ffffff,bg=cyan,bold,underline" source "$_plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" -# shell options -unsetopt autocd # don't cd into directories by name -setopt NO_BEEP # no terminal bell -setopt AUTO_PUSHD # cd pushes to directory stack -setopt PUSHD_IGNORE_DUPS # no duplicates in directory stack -setopt EXTENDED_GLOB # enable extended glob operators (#, ~, ^) - -# ggman -eval "$(ggman shellrc)" - -# custom functions and aliases +# aliases and functions source "$ZDOTDIR/aliases.zsh" source "$ZDOTDIR/scripts.zsh" @@ -66,5 +60,10 @@ zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache" zstyle ':completion:*' menu select zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' +# tool hooks +eval "$(ggman shellrc)" eval "$(starship init zsh)" eval "$(direnv hook zsh)" + +# gnupg +export GPG_TTY=$(tty)