Problem
--here mode in tmuxp uses send_keys to inject infrastructure commands (cd, export, shell replacement) into the active pane. This has three failure modes:
export is not POSIX-universal — it's a syntax error in fish, nu, and other non-bash/zsh shells
- Types into foreground programs — if the active pane is running
vim, python, htop, etc., the cd/export commands are typed as input, corrupting the user's session
- Shell history pollution —
cd and export commands appear in the user's shell history
What tmuxp does (3 categories of send_keys)
builder.py:695-727:
# 1. Directory change via send_keys
active_pane.send_keys(f"cd {shlex.quote(start_directory)}", enter=True)
# 2. Environment vars via send_keys (N calls, one per var)
_here_pane.send_keys(f"export {_ekey}={shlex.quote(str(_eval))}", enter=True)
# 3. Shell replacement via send_keys
_here_pane.send_keys(window_shell, enter=True)
What teamocil does (1 category of send_keys)
teamocil's --here only uses send_keys for cd — the one unavoidable case. Everything else uses tmux primitives:
- Window rename:
rename-window — tmux command, not send_keys
- Directory (
cd): send_keys cd "/path" — only send_keys usage
- Pane splitting:
split-window -c '/path' — tmux primitive with -c for directory
- Environment vars: Not handled at all — no
send_keys export
- Shell replacement: Not handled — teamocil doesn't change the running shell
tmuxinator similarly never uses send_keys for infrastructure — only for user-specified pane commands. Directories use -c on new-window and splitw.
Impact
Categories 2 and 3 (export and window_shell) are tmuxp-specific — neither Ruby tool does this. They are the primary source of the POSIX shell assumption and the "types into vim" failure mode.
Proposed solutions
Two approaches, tracked as sub-issues:
References
Problem
--heremode in tmuxp usessend_keysto inject infrastructure commands (cd,export, shell replacement) into the active pane. This has three failure modes:exportis not POSIX-universal — it's a syntax error infish,nu, and other non-bash/zsh shellsvim,python,htop, etc., thecd/exportcommands are typed as input, corrupting the user's sessioncdandexportcommands appear in the user's shell historyWhat tmuxp does (3 categories of
send_keys)builder.py:695-727:What teamocil does (1 category of
send_keys)teamocil's
--hereonly usessend_keysforcd— the one unavoidable case. Everything else uses tmux primitives:rename-window— tmux command, notsend_keyscd):send_keys cd "/path"— onlysend_keysusagesplit-window -c '/path'— tmux primitive with-cfor directorysend_keys exporttmuxinator similarly never uses
send_keysfor infrastructure — only for user-specified pane commands. Directories use-connew-windowandsplitw.Impact
Categories 2 and 3 (
exportandwindow_shell) are tmuxp-specific — neither Ruby tool does this. They are the primary source of the POSIX shell assumption and the "types into vim" failure mode.Proposed solutions
Two approaches, tracked as sub-issues:
session.set_environment()for env vars,respawn-panefor shell replacement, keepsend_keys cdonlysend_keysentirely — usesplit-window/swap-pane/kill-paneto create a fresh pane with correct dir+envReferences
--hereimplementation:window.rb:67-95-c:split_window.rb--heretests:window_spec.rb:110-145send_keysfor infra):window.rb:120-123-c:pane.rb:53-58