move PATH to .zshenv so non-interactive shells see it

.zshrc only runs for interactive shells — cron, ssh host-command, and
GUI-launched processes never sourced PATH before. Also includes pending
tmux theme/terminal-overrides work and rsync2/wm aliases.
This commit is contained in:
svxf
2026-04-15 22:39:38 +02:00
parent 6612cb02f1
commit 05d975a6c1
3 changed files with 39 additions and 21 deletions

View File

@@ -9,9 +9,12 @@ set -s set-clipboard on
set -g allow-passthrough on
# utf8 / colors
set -g default-terminal "screen-256color"
set -q -g status-utf8 on
setw -q -g utf8 on
set -g default-terminal "tmux-256color"
set -as terminal-overrides ",*:Tc"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
set -g extended-keys on
set -as terminal-features 'xterm*:extkeys'
# panes retain path
bind '"' split-window -v -c "#{pane_current_path}"
@@ -27,6 +30,10 @@ bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# alt+[ / alt+] pane switching (prev/next)
bind -n M-[ select-pane -t :.-
bind -n M-] select-pane -t :.+
# swap windows left/right with PgUp/PgDn (no wrap)
bind-key -n PgUp if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | head -1) ]" "swap-window -t -1\; select-window -t -1"
bind-key -n PgDn if-shell "[ #{window_index} -ne $(tmux list-windows -F '##{window_index}' | tail -1) ]" "swap-window -t +1\; select-window -t +1"
@@ -36,6 +43,7 @@ set -s escape-time 10
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
set -g detach-on-destroy off
# Auto-rename windows: directory/process
set -g automatic-rename on
@@ -44,21 +52,24 @@ set -g automatic-rename-format '#{pane_current_command}@#{b:pane_current_path}#{
# Rename window (prefix + R)
bind R command-prompt -I "#{window_name}" "rename-window '%%'"
# Move window to session (prefix + M), creates session if needed
bind M run-shell 'tmux display-popup -E "tmux-move-to-session #{window_id}"'
# Fuzzy window switcher (prefix + f)
bind f display-popup -E "tmux list-windows -F '#{window_index}: #{window_name}' | fzf --reverse | cut -d: -f1 | xargs tmux select-window -t"
bind f display-popup -h 80% -E "tmux list-windows -F '#{window_index}: #{window_name}' | fzf --reverse --height=100% | cut -d: -f1 | xargs tmux select-window -t"
# status bar
set -g status-style "bg=colour235,fg=colour248"
set -g status-left "#[fg=colour232,bg=colour34,bold]#S#[fg=colour34,bg=colour235,nobold]"
set -g status-style "bg=#262626,fg=#a8a8a8"
set -g status-left "#[fg=#080808,bg=#00af00,bold]#S#[fg=#00af00,bg=#262626,nobold]"
set -g status-left-length 30
set -g status-right ""
set -g status-right-length 40
# window tabs
setw -g window-status-format "#{?#{m:*[13579],#{window_index}},#[fg=colour235]#[bg=colour236]#[fg=colour250] #I #W #[fg=colour236]#[bg=colour235],#[fg=colour235]#[bg=colour233]#[fg=colour244] #I #W #[fg=colour233]#[bg=colour235]}"
setw -g window-status-current-format "#[fg=colour235,bg=colour34]#[fg=colour232,bg=colour34,bold] #I #W #[fg=colour34,bg=colour235]"
setw -g window-status-format "#{?#{m:*[13579],#{window_index}},#[fg=#262626]#[bg=#282828]#[fg=#848484] #I #W #[fg=#282828]#[bg=#262626],#[fg=#262626]#[bg=#1e1e1e]#[fg=#747474] #I #W #[fg=#1e1e1e]#[bg=#262626]}"
setw -g window-status-current-format "#[fg=#262626,bg=#00af00]#[fg=#080808,bg=#00af00,bold] #I #W #[fg=#00af00,bg=#262626]"
setw -g window-status-separator ""
# pane borders
set -g pane-border-style "fg=colour238"
set -g pane-active-border-style "fg=colour34"
set -g pane-border-style "fg=#444444"
set -g pane-active-border-style "fg=#00af00"

13
.zshenv Normal file
View File

@@ -0,0 +1,13 @@
# .zshenv — sourced for every zsh invocation (interactive, non-interactive, scripts).
# PATH lives here so cron, ssh host-command, and GUI-launched processes see it.
typeset -U path
path=(
/projects/bin
$HOME/.local/bin
$HOME/.cargo/bin
/usr/local/go/bin
$HOME/go/bin
/opt/homebrew/bin
$path
)

16
.zshrc
View File

@@ -110,17 +110,7 @@ zinit light starship/starship
git --git-dir=$HOME/.dotgit/ --work-tree=$HOME pull --ff-only -q 2>/dev/null
} &!
# paths
typeset -U path
path=(
/projects/bin
$HOME/.local/bin
$HOME/.cargo/bin
/usr/local/go/bin
$HOME/go/bin
/opt/homebrew/bin
$path
)
# paths live in ~/.zshenv so non-interactive shells (cron, ssh cmd, GUI) see them
# fzf (if available)
if (( $+commands[fzf] )); then
@@ -198,9 +188,13 @@ alias dcu='docker compose up --force-recreate --detach'
alias dcd='docker compose down --remove-orphans'
alias dcl='docker compose logs -f'
# aliases: rsync with sane defaults
alias rsync2='rsync --info=PROGRESS2 --progress --recursive --compress --human-readable --update --times --no-whole-file --itemize-changes --stats --verbose --links --no-perms --chmod=ugo=rwX'
# aliases: misc
alias c="claude"
alias ,cd="IS_SANDBOX=1 claude --dangerously-skip-permissions"
alias wm="workmux"
alias zshreload="exec zsh"
alias -g LATEST='*(om[1])' # glob: most recently modified
alias FUNCTION_PRELUDE="setopt LOCAL_OPTIONS PIPE_FAIL XTRACE ERR_RETURN"