Skip to content

fix(tmux): enable clipboard by auto-installing TPM plugins#82

Merged
edge2992 merged 2 commits into
mainfrom
fix/tmux-yank-autoinstall
May 9, 2026
Merged

fix(tmux): enable clipboard by auto-installing TPM plugins#82
edge2992 merged 2 commits into
mainfrom
fix/tmux-yank-autoinstall

Conversation

@edge2992
Copy link
Copy Markdown
Owner

@edge2992 edge2992 commented May 9, 2026

Summary

  • Add run_onchange_install-tmux-plugins.sh.tmpl so TPM plugins (tmux-yank, etc.) are installed non-interactively on chezmoi apply. Previously only TPM itself was cloned via .chezmoiexternal.toml, leaving plugins missing until the user manually pressed prefix + I.
  • Drop the self-defined copy-mode-vi y/Enter bindings in dot_tmux.conf so tmux-yank can install its OS-aware copy-pipe bindings (wl-copy / xclip / pbcopy).
  • Enable OSC52 (set-clipboard on + terminal-features ',xterm*:clipboard') as a fallback for terminals like WezTerm, useful when external clipboard tools are unavailable (e.g. SSH).

Closes the gap left by ffb0865 (which only added wl-clipboard to the install list).

Test plan

  • make lint passes
  • chezmoi diff shows expected hunks
  • chezmoi apply runs the new script and ~/.tmux/plugins/ is fully populated (tpm tmux-yank tmux-resurrect tmux-continuum tmux-mem-cpu-load tmux)
  • After tmux source ~/.tmux.conf, tmux list-keys -T copy-mode-vi shows y bound to copy-pipe-and-cancel wl-copy
  • tmux show-options -g set-clipboard is on
  • In tmux: prefix + [v to select → y → paste into a non-WezTerm app (browser, etc.) succeeds

edge2992 added 2 commits May 9, 2026 12:36
Previous fix (ffb0865) added wl-clipboard but copy-paste still didn't
work. The real causes were:

- TPM was cloned by chezmoiexternal but plugins (tmux-yank, etc.) were
  never installed; required manual `prefix + I`.
- copy-mode-vi `y` and `Enter` were bound to copy-selection-and-cancel,
  which only fills the tmux internal buffer and overrode the bindings
  tmux-yank would otherwise install.

Add a run_onchange_ script that invokes TPM's install_plugins
non-interactively (triggered by dot_tmux.conf hash). Drop the self-
defined `y`/`Enter` overrides so tmux-yank can install its OS-aware
copy-pipe bindings (wl-copy / xclip / pbcopy). Also enable OSC52 via
set-clipboard for terminals like WezTerm, providing a fallback when
external clipboard tools are unavailable (e.g. SSH sessions).
- Fail loudly (exit 1) when TPM is missing instead of silently
  skipping; .chezmoiexternal.toml is responsible for cloning it
  beforehand, so its absence is an error worth surfacing.
- Drop redundant terminal-features for 'wezterm' since the 'xterm*'
  glob already matches WezTerm's default TERM (xterm-256color).
- Document the run_onchange_ trigger so it is clear that the script
  re-runs on dot_tmux.conf changes (which carry the @plugin list).
@edge2992 edge2992 merged commit 883a723 into main May 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant