fix(tmux): enable clipboard by auto-installing TPM plugins#82
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_onchange_install-tmux-plugins.sh.tmplso TPM plugins (tmux-yank, etc.) are installed non-interactively onchezmoi apply. Previously only TPM itself was cloned via.chezmoiexternal.toml, leaving plugins missing until the user manually pressedprefix + I.copy-mode-viy/Enterbindings indot_tmux.confso tmux-yank can install its OS-aware copy-pipe bindings (wl-copy / xclip / pbcopy).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-clipboardto the install list).Test plan
make lintpasseschezmoi diffshows expected hunkschezmoi applyruns the new script and~/.tmux/plugins/is fully populated (tpm tmux-yank tmux-resurrect tmux-continuum tmux-mem-cpu-load tmux)tmux source ~/.tmux.conf,tmux list-keys -T copy-mode-vishowsybound tocopy-pipe-and-cancel wl-copytmux show-options -g set-clipboardisonprefix + [→vto select →y→ paste into a non-WezTerm app (browser, etc.) succeeds