Skip to content

feat(linux-editor): Vim keybindings in the SQL editor - #3804

Merged
datlechin merged 13 commits into
mainfrom
feat/3651-linux-vim-mode
Oct 23, 2026
Merged

datlechin merged 13 commits into
mainfrom
feat/3651-linux-vim-mode

Conversation

@datlechin

@datlechin datlechin commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Preferences → Editor → Keyboard has a Vim Keybindings switch, stored in GSettings (vim-keybindings, off by default). Open editor tabs follow it at once.
  • With it on, the SQL editor runs GtkSourceVimIMContext: normal, insert, replace and visual modes. A bar under the text shows the mode and the pending command.
  • :w saves as Ctrl+S does. :w name creates that file next to the tab's file and leaves an existing one alone; :w! name replaces it.
  • :e reads the tab's file again and asks before it drops changes; :e! does not ask. :e name opens a file in the tab as Open SQL File does.
  • :q closes the tab through the same prompts as Ctrl+W. :wq and :x save, then close, and keep the tab when the save fails or is cancelled.
  • The editor's Ctrl shortcuts (run, run statement, format, comment, find, find and replace, find next and previous, open, save, save as) work in every Vim mode. App and tab shortcuts already run before the editor.
  • Escape is Vim's while it is on, so the Stop button stops a run. Completion runs in insert mode only, and leaving insert mode cancels an open list.
  • Save and Save As now report whether the write landed, which :wq waits on. file_write::create_file writes a new file only when none has its name.
  • Open SQL File asks first when the tab's file was emptied and not saved; it used to replace it without asking.
  • README section, ROADMAP and the settings table in docs/storage.md.

Test plan

  • Widget tests: the switch attaches and detaches Vim on open tabs; :q, :w, :wq (a failed write keeps the tab), :x, :w name, :w! name, :e, :e!, :e name; :q goes through the workspace close prompts and closes its own tab.
  • Real key tests on X11: x, i, Escape and v in Vim; Ctrl+Return and Ctrl+Shift+Return run from normal and insert mode; Ctrl+/ and Ctrl+F from normal mode and the command line; Escape stays Vim's while a query runs; :w Return saves and :q Return asks to close; leaving insert mode closes the completion list and it stays closed in normal mode; turning Vim off gives completion back.
  • Every Ctrl key the editor owns is kept from Vim, checked against the accelerator table.
  • verify.sh build, test, lint, l10n and data; meson test under xvfb as the CI fast job.

Screenshots

Preferences → Editor, before and after:

Light Dark
Before Before, light Before, dark
After After, light After, dark

The editor with Vim on: insert mode, visual line mode, a pending 2d, and :w typed on the command line.

Light Dark
Insert mode, light Insert mode, dark
Visual line, light Visual line, dark
Pending command, light Pending command, dark
Command line, light Command line, dark

Fixes #3651

@datlechin
datlechin enabled auto-merge (squash) October 23, 2026 06:55
# Conflicts:
#	linux/ROADMAP.md
#	linux/crates/storage/tests/settings.rs
@datlechin
datlechin merged commit 4872c5a into main Oct 23, 2026
30 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.

Vim mode in the Linux SQL editor

1 participant