Skip to content

tmux-vim: add a plugin for tmux-style prefix keys and vim-style navigation - #433

Draft
lyndonoc wants to merge 1 commit into
mainfrom
bb/tmux-vim-plugin-thr_eedmg4skuu
Draft

lyndonoc wants to merge 1 commit into
mainfrom
bb/tmux-vim-plugin-thr_eedmg4skuu

Conversation

@lyndonoc

Copy link
Copy Markdown

Adds tmux-vim, a plugin that drives bb from the keyboard in the style of tmux and vim:

  • a prefix key (Ctrl-a by default) followed by one key, to move between panes, split, resize, zoom and close them, and to switch threads;
  • Ctrl-h/j/k/l to move between panes and into the sidebar without the prefix;
  • vim browsing keys in a conversation (j, k, gg, G, /, : and more), active only while not typing;
  • a thread chooser that opens a thread in the current pane or a new one, or starts a new thread in a new pane;
  • a copy mode like tmux's (v to select, y to copy), and copy on mouse selection;
  • each pane remembers whether it was left while typing.

Every key, setting and known limit is in plugins/tmux-vim/README.md.

The plugin is frontend only. A content script owns one capture-phase keydown listener and a small state machine; an app overlay publishes bb's React hooks to it and draws the chooser, the key help and the mode pill. server.ts only declares the settings.

Merging to bb-plugins main moves the bb-server pin, builds a new image and stages a restart for every developer's server.

What changes

  • plugins/tmux-vim/: the new plugin, with its tests, README, PLUGIN_OVERVIEW.md and a skill.
  • .bb/plugins.json: registers tmux-vim, so --plugin tmux-vim works.
  • README.md: adds its row to the table.
  • .github/workflows/plugins.yaml: adds tmux-vim to the plugins CI checks.

Testing

  • From a clean checkout, in plugins/tmux-vim: npm install --include=dev --legacy-peer-deps --no-audit --no-fund, npm run typecheck and npm test pass (32 files, 2248 tests). Install scripts were skipped on my machine (--ignore-scripts); CI runs them.
  • Used by hand in bb desktop 0.50.1 on macOS for the pane, thread, chooser and resize keys. Copy mode, copy on select and the per-pane typing memory are covered by the automated tests, which run against a copy of bb's page structure in jsdom.

Open questions, and why this is a draft

  • SDK pin. The plugin pins @get-bb/plugin-sdk 0.6.157 (bb 0.50.1), which is newer than every other plugin here. Its engines allow bb 0.49 and SDK 0.6.132 or later. Should the pin match what bb-server bundles?
  • bb internals. bb has no plugin API for closing or focusing a pane, resizing, scrolling a conversation or reading the sidebar order. For those the plugin reads bb's page structure, clicks bb's own controls or replays bb's own shortcuts with synthetic events. Every such selector, event and command id is in src/constants.ts. They were read from bb 0.49.0 and checked again against the 0.50.1 source, so a bb update can break individual keys.
  • Opt-in. It takes Ctrl-a, Ctrl-h/j/k/l and plain letters while the cursor is not in a text field, so it should be something a person chooses to install. If plugins in this repo are installed for everyone, the enabled setting should default to off.
  • Split below. It uses sdk.threads.open with split: "down", which bb applies in every connected window. Split right stays local.

🤖 Generated with Claude Code

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