Skip to content

feat(web): optional Vim keybindings in the editor - #32

Merged
RyPope merged 2 commits into
RyPope:mainfrom
silviu-life:feat/vim-mode
Nov 22, 2026
Merged

RyPope merged 2 commits into
RyPope:mainfrom
silviu-life:feat/vim-mode

Conversation

@silviu-life

Copy link
Copy Markdown
Contributor

What and why

Adds optional Vim keybindings to the code editor, for people who practise in Vim and keep reaching for dd/ciw in the browser.

  • A Vim button in the editor toolbar (next to the font-size controls) turns Vim mode on or off. It's off by default and remembered with the other editor preferences (pref("vim")).
  • When it's on, a mode line under the editor shows the current mode and pending keys (--NORMAL--, --INSERT--, : commands).
  • Built on monaco-vim 0.4.4 (MIT, pinned exactly), so it's bundled and works offline like the rest of Monaco.
  • vite.config.ts gets a one-line alias: monaco-vim imports monaco-editor/esm/vs/..., which monaco-editor 0.57's exports map rejects, so the Docker web build failed without it. The alias maps those imports to the paths monaco-editor exports.
  • ⌘↵ / ⌘⇧↵ (Run / Submit) still work in Vim mode. In Normal mode Vim takes some Ctrl keys for itself, as usual (Ctrl+V block select, Ctrl+R redo).

How it was tested

  • npm run lint, format:check, typecheck, npm test and npm run build pass. The full app image builds with docker compose up -d --build.
  • Checked by hand with Playwright against a running instance: the toggle sets aria-pressed; o gives --INSERT-- and inserts text, Esc gives --NORMAL--; the setting survives a reload.
  • No new unit test. The web suite only covers lib/ logic and has no component test setup, and this change is UI wiring. The production build step in make test-web does catch the alias regression. Happy to add a component test if you'd like one, though that means adding jsdom and Testing Library.
Before After (Vim on, back in Normal mode)
before after

Checklist

  • make lint and make test pass (web parts run; backend/runner untouched)
  • Behaviour changes come with a test that fails without them (see above)
  • API response changes: n/a
  • UI changes: screenshots attached
  • No problem statements, test cases or solutions from upstream sources are committed

🤖 Generated with Claude Code

silviu-life and others added 2 commits November 16, 2026 23:20
Add a Vim toggle to the editor toolbar, backed by monaco-vim. The choice is
stored with the other editor preferences, and a mode line under the editor
shows the current mode and pending commands.

monaco-vim imports monaco-editor/esm/vs/... paths, which monaco-editor 0.57's
exports map rejects, so vite.config.ts aliases them to the exported paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vite resolves monaco-vim through the "browser" condition, whose UMD
build inlines about 33 modules from monaco-editor 0.33. The ESM build
imports our own monaco-editor, so alias monaco-vim to it.
@RyPope

RyPope commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Thanks for this, @silviu-life

@RyPope
RyPope merged commit 60ac3a9 into RyPope:main Nov 22, 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.

2 participants