Skip to content

feat(windows): Vim mode in the SQL editor - #4338

Merged
datlechin merged 10 commits into
mainfrom
feat/windows-vim
Nov 19, 2026
Merged

datlechin merged 10 commits into
mainfrom
feat/windows-vim

Conversation

@datlechin

@datlechin datlechin commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Vim mode in the Windows SQL editor, behind a Settings switch in the Editor section, off by default (roadmap W-40).
  • TablePro.Editor.Model/Vim: a C# port of the macOS engine (motions, operators, counts, registers, marks, macros, dot repeat, text objects, search, Visual and Visual Line, Replace, the command line).
  • Each key is one undo step and an insert is one step up to Escape; an arrow or a click inside an insert splits it, and u inside a replayed macro undoes the macro's own step. A macro replays typed text; keys Insert mode leaves to the editor (arrows, Ctrl shortcuts) stay out of it, as on macOS (0017, Consequences).
  • A paste, click or menu command that moves the selection ends Visual mode.
  • Closed folds count as one line for j, k, Ctrl+D/U/F/B and Visual moves; linewise operators, V, p and o take a fold whole; gj/gk move by wrapped rows; H/M/L read the rows on screen; zo, zc, za, zR, zM, zz, zt, zb, Ctrl+E and Ctrl+Y.
  • Keys: Vim takes only the Ctrl chords it defines (Ctrl+C, V, Z, S and Ctrl+Enter stay with Windows), Ctrl+[ is Escape, arrows and Home/End/Page keys are Vim's outside Insert, input method text is Vim's keys outside Insert.
  • Block caret outside Insert and Replace; a mode badge with pending keys and recording @q on the query tab's bar, where macOS shows its badge.
  • :w runs the query, :q closes the tab, :tabnext/:tabprevious/gt/gT select tabs.
  • Yanks and deletes reach the clipboard as on macOS, kept out of Win+V history and roaming.
  • Where the macOS engine has a defect, the port fixes it and 0017 lists it: Escape, or leaving the command line, drops a whole pending command, % and a failed f handle a pending operator, counted p/P paste whole copies of one register, a Visual text object moves Visual's ends, marks follow every edit, a and p stay on an empty line, ip keeps the last character, word motions step over variation selectors, and Enter, +, - move to a line's first character. The macOS engine is unchanged here.
  • Decision record windows/docs/decisions/0017-vim-mode.md; 0002's Consequences and the AGENTS map point to it.

Test plan

  • tests/TablePro.Editor.Model.Tests/Vim: every macOS suite in apple/TableProTests/Core/Vim ported (mock undo counts became real undo checks), plus folds and rows, undo and status, command edges, key routing and tab targets. 896 pass on macOS.
  • tests/TablePro.Editor.Tests/VimTests.cs: key routing, block caret, Replace-mode commits, ex commands and zc/zo in a real editor (Windows jobs).
  • tests/TablePro.App.UITests/VimModeTests.cs: the Settings switch, then editing, pending keys, Visual mode and :w in a query tab, with screenshots 180 to 183 (Windows jobs).
  • verify.sh --platform windows build and test: PASS.

Screenshots

Before: the query bar and Settings had no Vim badge or switch. After (Arm64 CI run, light and dark):

Settings, Vim mode Settings, Vim mode, dark
Normal mode with 2d pending Normal mode with 2d pending, dark
Visual mode Visual mode, dark

…hem and let a click drop a pending Visual command
…replay any recorded editor key and place M by the rows on screen
…ape left in an insert's undo step and retry a refused clipboard write
…P, append and paste on an empty line, ip at the end and words with variation selectors
# Conflicts:
#	windows/docs/decisions/README.md
…caret at an undone selection's start and keep inserts whole past the undo limit
@datlechin
datlechin merged commit 2282cba into main Nov 19, 2026
15 of 16 checks passed
@datlechin
datlechin deleted the feat/windows-vim branch November 19, 2026 06:23
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