René's URL Explorer Experiment


Title: here mode level 2: eliminate send_keys entirely — split-window/swap-pane/kill-pane · Issue #1032 · tmux-python/tmuxp · GitHub

Open Graph Title: here mode level 2: eliminate send_keys entirely — split-window/swap-pane/kill-pane · Issue #1032 · tmux-python/tmuxp

X Title: here mode level 2: eliminate send_keys entirely — split-window/swap-pane/kill-pane · Issue #1032 · tmux-python/tmuxp

Description: Parent: #1030 Approach Eliminate all send_keys usage in --here mode by replacing the "mutate existing pane" pattern with "create fresh pane, swap into position." This is the cleanest possible approach — zero shell assumptions. Core idea ...

Open Graph Description: Parent: #1030 Approach Eliminate all send_keys usage in --here mode by replacing the "mutate existing pane" pattern with "create fresh pane, swap into position." This is the cleanest possible appro...

X Description: Parent: #1030 Approach Eliminate all send_keys usage in --here mode by replacing the "mutate existing pane" pattern with "create fresh pane, swap into position." This is the cle...

Opengraph URL: https://github.com/tmux-python/tmuxp/issues/1032

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"here mode level 2: eliminate send_keys entirely — split-window/swap-pane/kill-pane","articleBody":"Parent: #1030\n\n## Approach\n\nEliminate all `send_keys` usage in `--here` mode by replacing the \"mutate existing pane\" pattern with \"create fresh pane, swap into position.\" This is the cleanest possible approach — zero shell assumptions.\n\n### Core idea\n\nInstead of sending `cd`, `export`, and shell commands to the existing pane (which assumes a POSIX shell is running), create a brand-new pane with the correct directory, environment, and shell, then swap it into the position of the original pane and kill the original.\n\n### Implementation\n\nReplace [`builder.py:690-727`](https://github.com/tmux-python/tmuxp/blob/886e63d37dbfeeefab1e645f168178b13ff03b7f/src/tmuxp/workspace/builder.py#L690-L727):\n\n```python\n# Before: send_keys cd, export, shell into existing pane\nactive_pane.send_keys(f\"cd {shlex.quote(start_directory)}\", enter=True)\nfor _ekey, _eval in environment.items():\n    _here_pane.send_keys(f\"export {_ekey}={shlex.quote(str(_eval))}\", enter=True)\n_here_pane.send_keys(window_shell, enter=True)\n```\n\nWith:\n\n```python\n# After: create fresh pane with correct state, swap into position\n_active_pane = window.active_pane\nassert _active_pane is not None\n\n# Build split-window args\nsplit_kwargs: dict[str, t.Any] = {}\nif start_directory:\n    split_kwargs[\"start_directory\"] = start_directory\nif environment:\n    split_kwargs[\"environment\"] = environment\nif window_shell:\n    split_kwargs[\"shell\"] = window_shell\n\n# Create new pane with correct dir/env/shell via tmux primitives\nnew_pane = window.split(**split_kwargs)\n\n# Swap new pane into the position of the original\nnew_pane.cmd(\"swap-pane\", \"-t\", _active_pane.pane_id)\n\n# Kill the original pane (now in the split position)\n_active_pane.kill()\n```\n\n### How this maps to tmux commands\n\n```\ntmux split-window -c /path/to/dir -e KEY=VALUE [shell_command]\ntmux swap-pane -t %original_pane_id\ntmux kill-pane -t %original_pane_id\n```\n\n### tmux version requirements\n\n- `split-window -c`: Available since tmux 1.9\n- `split-window -e`: Available since tmux 3.2 (tmuxp's minimum)\n- `swap-pane`: Available since tmux 0.8\n- All within tmuxp's tmux 3.2+ minimum requirement\n\n### Comparison with teamocil\n\nteamocil uses [`send_keys cd`](https://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/tmux/window.rb#L88-L95) for directory and [`split-window -c`](https://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/command/split_window.rb#L3-L13) for new panes. This approach goes further than teamocil by eliminating even the `cd` send_keys call.\n\n### Trade-offs\n\n**Pros:**\n- Zero `send_keys` for infrastructure — no shell assumption at all\n- Works regardless of what's running in the active pane (vim, python, fish)\n- Environment set at pane creation time via `-e` (tmux 3.2+)\n- Directory set via `-c` (tmux primitive)\n- Clean pane with fresh shell — no history pollution\n\n**Cons:**\n- Destroys the user's existing shell state (history, local variables, aliases loaded via `.bashrc`)\n- Brief visual flash as the swap occurs\n- More complex than Level 1 — uses `swap-pane` + `kill-pane` which is unusual in libtmux\n- The existing pane is killed — if the user had unsaved work in a background process, it's gone\n- May need libtmux API additions if `split()` doesn't support `-e` kwargs yet\n\n### Behavioral change\n\nThis changes `--here` semantics from \"modify the existing pane in-place\" to \"replace the existing pane with a fresh one.\" Users who rely on existing shell state in the first pane would lose it. This may be acceptable since `--here` is conceptually \"rebuild this window\" — but it should be documented.\n\n### Tests to add/update\n\n- Rewrite `test_here_mode_provisions_environment` to verify env via pane capture (new pane inherits env)\n- Rewrite `test_here_mode_start_directory_special_chars` to verify cwd without `send_keys`\n- Add test verifying `--here` works when active pane runs a non-shell program\n- Add test verifying original pane is replaced (pane count stays at 1)\n\n### libtmux prerequisites\n\nCheck whether `window.split()` supports:\n- `environment` kwarg (maps to `-e KEY=VALUE`)\n- `shell` kwarg (maps to the shell/command argument)\n- `start_directory` kwarg (maps to `-c`)\n\nIf not, these would need to be added to libtmux first.","author":{"url":"https://github.com/tony","@type":"Person","name":"tony"},"datePublished":"2026-03-29T09:33:17Z","url":"https://github.com/tmux-python/tmuxp/issues/1032"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b63cc249-351c-eb6b-be3c-3cfeddcf5a02
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAC1C:3B8E5E:288EB2:382F41:6B008895
html-safe-nonceca33b2f02b5266f8bbc5ee91f91b9a111a497fde94c3d2068ef4e1eda9a790b6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzFDOjNCOEU1RToyODhFQjI6MzgyRjQxOjZCMDA4ODk1IiwidmlzaXRvcl9pZCI6IjYzMzM5MjA0ODk0Nzk2MzcxNDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca935760c569a5647a7ba74ef9b49ff984894a24dcd4ca3c8c14eca8f5068a9b6
hovercard-subject-tagissue:4163552222
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/tmux-python/tmuxp/1032/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d49339f0353fa71b30fe687ec0d9a62bbef44574708e9442bc873650f311b707/tmux-python/tmuxp/issues/1032
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d49339f0353fa71b30fe687ec0d9a62bbef44574708e9442bc873650f311b707/tmux-python/tmuxp/issues/1032
og:image:altParent: #1030 Approach Eliminate all send_keys usage in --here mode by replacing the "mutate existing pane" pattern with "create fresh pane, swap into position." This is the cleanest possible appro...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametony
hostnamegithub.com
expected-hostnamegithub.com
None4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61
turbo-cache-controlno-preview
go-importgithub.com/tmux-python/tmuxp git https://github.com/tmux-python/tmuxp.git
octolytics-dimension-user_id37234308
octolytics-dimension-user_logintmux-python
octolytics-dimension-repository_id12398170
octolytics-dimension-repository_nwotmux-python/tmuxp
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id12398170
octolytics-dimension-repository_network_root_nwotmux-python/tmuxp
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasedb758f8e02b8257935fb03edf81a3e76eb3abd11
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/tmux-python/tmuxp/issues/1032#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftmux-python%2Ftmuxp%2Fissues%2F1032
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ftmux-python%2Ftmuxp%2Fissues%2F1032
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=tmux-python%2Ftmuxp
Reloadhttps://github.com/tmux-python/tmuxp/issues/1032
Reloadhttps://github.com/tmux-python/tmuxp/issues/1032
Reloadhttps://github.com/tmux-python/tmuxp/issues/1032
tmux-pythonhttps://github.com/tmux-python
tmuxphttps://github.com/tmux-python/tmuxp
Codehttps://github.com/tmux-python/tmuxp
Issues113 (113)https://github.com/tmux-python/tmuxp/issues
Pull requests29 (29)https://github.com/tmux-python/tmuxp/pulls
Discussionshttps://github.com/tmux-python/tmuxp/discussions
Actionshttps://github.com/tmux-python/tmuxp/actions
Security and qualityhttps://github.com/tmux-python/tmuxp/security
Insightshttps://github.com/tmux-python/tmuxp/insights
https://github.com/tmux-python/tmuxp
New issuehttps://github.com/login?return_to=https://github.com/tmux-python/tmuxp/issues/1032
New issuehttps://github.com/login?return_to=https://github.com/tmux-python/tmuxp/issues/1032
here mode level 2: eliminate send_keys entirely — split-window/swap-pane/kill-panehttps://github.com/tmux-python/tmuxp/issues/1032#top
https://github.com/tony
tonyhttps://github.com/tony
on Mar 29, 2026https://github.com/tmux-python/tmuxp/issues/1032#issue-4163552222
#1030https://github.com/tmux-python/tmuxp/issues/1030
builder.py:690-727https://github.com/tmux-python/tmuxp/blob/886e63d37dbfeeefab1e645f168178b13ff03b7f/src/tmuxp/workspace/builder.py#L690-L727
send_keys cdhttps://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/tmux/window.rb#L88-L95
split-window -chttps://github.com/remi/teamocil/blob/9ceecf5/lib/teamocil/command/split_window.rb#L3-L13
tonyhttps://github.com/tony
on Mar 29, 2026https://github.com/tmux-python/tmuxp/issues/1032#event-24007910879
here mode: send_keys for env vars and shell replacement diverges from teamocil and is unsafe #1030https://github.com/tmux-python/tmuxp/issues/1030
tmux-pythonhttps://github.com/tmux-python
https://github.com/undefined
on Apr 19, 2026https://github.com/tmux-python/tmuxp/issues/1032#event-24649263892
Sign up for freehttps://github.com/signup?return_to=https://github.com/tmux-python/tmuxp/issues/1032
Sign in to commenthttps://github.com/login?return_to=https://github.com/tmux-python/tmuxp/issues/1032
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.