Skip to content

Vim keybindings in the GUI editor (default), Settings menu to switch - #4

Merged
krolyxon merged 3 commits into
masterfrom
vim
Nov 1, 2026
Merged

krolyxon merged 3 commits into
masterfrom
vim

Conversation

@krolyxon

@krolyxon krolyxon commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

The GUI's code editor now uses Vim keybindings by default. A new Settings menu switches to standard keys (and holds Theme).

  • Engine (crates/bench51-gui/src/vim/) is pure logic over a String and a char cursor, with 17 unit tests:
    • modes: Normal, Insert, Visual, Visual Line, plus the :// command line;
    • motions with counts, and d c y > < with motions and text objects (iw a" i( ip …);
    • registers, undo/redo, . repeat, macros, and smartcase search with highlighting;
    • :w :q :wq :x :qa :e :42 :make :noh :bn;
    • gd jumps to a label's definition, and new lines line up with the instruction column after a label.
  • Editor: a block cursor and a mode line (with a red REC while a macro records). Mouse drags enter Visual mode. Yanks and deletes go to the system clipboard (like clipboard=unnamedplus), and Ctrl+V pastes. The editor is read-only during debug sessions, but moving, searching and yanking still work. In Vim mode a focused editor keeps Ctrl-F for paging; Find is reachable through / and Edit → Find.
  • Settings menu: Keybindings (Vim / Standard) and Theme, which moved from View. --keymap vim|standard picks one for a run. F1 shows a Vim section.
  • Fix: --theme, --keymap and --clock no longer overwrite the saved settings.

Draft: in-window testing stopped partway, because the screen locked during the test session. Verified in the real window so far: Vim mode by default, 5j and w motions, the block cursor, the mode line, and the Settings menu. Still to check by hand:

  • dd, u, ciw with .
  • / search highlight, n
  • V selection, qa…q showing REC
  • :w
  • mouse drag into Visual
  • debug session read-only
  • Settings → Keybindings → Standard

A pure state machine over a String and a char cursor: Normal, Insert,
Visual and Visual Line modes, motions with counts, d/c/y/>/< with motions
and text objects, registers, undo/redo, . repeat, macros, search with
smartcase, and : commands. gd finds a label's definition and new lines
line up after labels. Tested on plain text, with no UI.

Claude-Session: https://claude.ai/code/session_012YxheuG2dru3dVKn3ztmBZ
The focused editor's keys go to the Vim engine: block cursor, mode line,
mouse selections become Visual mode, yanks reach the system clipboard and
Ctrl+V pastes. A new Settings menu holds Keybindings (Vim / Standard) and
Theme, and --keymap picks one for a run.

Command-line --theme, --keymap and --clock no longer overwrite the saved
settings.

Claude-Session: https://claude.ai/code/session_012YxheuG2dru3dVKn3ztmBZ
Clippy on Rust 1.99 (CI's stable) flags chunks_exact with a constant size.

Claude-Session: https://claude.ai/code/session_012YxheuG2dru3dVKn3ztmBZ
@krolyxon
krolyxon marked this pull request as ready for review November 1, 2026 04:38
@krolyxon
krolyxon merged commit 23eb05f into master Nov 1, 2026
4 checks passed
@krolyxon
krolyxon deleted the vim branch November 1, 2026 04:42
krolyxon added a commit that referenced this pull request Nov 1, 2026
Vim keybindings in the GUI editor (default), Settings menu to switch
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