Repository navigation
Vim Modal Editing
GridLock includes a native, UTF-8 byte-addressed Vim Modal Editing Engine (VimInputHandler, VimMotionEngine, VimOperatorExecutor, VimTextObjectResolver, VimRegisterBank, and VimExCommandBar) built directly on PieceTable, SelectionSet, EditHistory, and TreeSitterService—without interfering with multi-rank debugger shortcuts (F5, F10, F11, Shift+F11, F12).
See also: Keyboard Shortcuts and Quick Reference · Configuration and Customization · Lua / LuaJIT gl.* API
Vim modal editing is opt-in (false by default) and can be toggled globally, per workspace, from the Ex command line, or from Lua:
-
Preferences Dialog: Open
Edit -> Preferences -> Editingand toggleEnable Vim modal editing. -
Global Config (
~/.config/gridlock/config.toml) or Workspace Override (.gridlock.toml):[editor] vim_mode = true
-
Inline Ex Command Bar (
:): Run:set vim,:set novim, or:set vim!. -
Lua Scripting (
init.lua):local active = gl.editor.vim_mode() -- query current boolean state gl.editor.vim_mode(true) -- enable across open editors
| Mode | Entry / Exit Keys | Cursor & Status Bar Indicator |
|---|---|---|
| Normal | Default when enabled; Esc or Ctrl+[ from any other mode |
Character-cell Block cursor (hollow when unfocused); -- NORMAL -- pill in the bottom-right status bar alongside live pending keys ("a2d, 5, g, f) |
| Insert |
i, I, a, A, o, O, c, cc, C, s, S
|
Thin Bar cursor; -- INSERT -- pill; typing and auto-indent coalesce into one EditHistory undo group closed on Esc / Ctrl+[
|
| Visual | v |
Characterwise inclusive selection; -- VISUAL -- pill |
| Visual Line | V |
Full-line selection; -- VISUAL LINE -- pill |
| Visual Block | Ctrl+V |
Multi-cursor rectangular column selection via SelectionSet::setBoxSelection; -- VISUAL BLOCK -- pill |
| Macro Recording |
q<a-z> / q<A-Z> / q<0-9> (press q in Normal mode to stop) |
Appends recording @<reg> to the status bar mode pill |
Note
Function-key debugger controls (F5 Continue/Start, F9 Toggle Breakpoint, F10 Step Over, F11 Step Into, Shift+F11 Step Out, F12 Go to Definition) pass straight through in every Vim mode.
All motions accept optional numeric prefixes ([count]) and compose uniformly across Normal movement, Visual extension, and Operator ranges:
| Category | Keys | Behavior |
|---|---|---|
| Character & Line |
h, j, k, l (and Arrow keys) |
Clamped intra-line UTF-8 codepoint movement and vertical line movement preserving preferred visual column |
| Words & WORDs |
w, b, e / W, B, E
|
Identifier/punctuation word starts & ends (w/b/e) and whitespace-delimited WORDs (W/B/E) |
| Intra-Line Bounds |
0, ^, $ (and Home / End) |
Column 0, first non-blank character, and end of line ([count]$ advances count - 1 lines) |
| Document & Paragraph |
gg, [count]G, {, }
|
First line (gg or [count]gg), last line / target line (G / 42G), and previous/next blank-line paragraph boundary |
| Bracket Match | % |
Jumps between balanced (), [], and {} pairs |
| Character Find |
f<ch>, F<ch>, t<ch>, T<ch>, ;, ,
|
Intra-line forward/backward find (f/F) and till (t/T) with ; (same direction) and , (reverse direction) repeats |
| Buffer Search |
/, ?, n, N, *, #
|
/ and ? open InlineFindBar; * and # search whole-word identifier under cursor forward/backward; n and N step next/previous match |
GridLock parses the full Vim operator grammar ["<reg>][count1][operator][count2][motion | text-object], multiplying count1 * count2 (for example, 2d3w deletes 6 words) and recording every edit—including c...<Esc> Insert sessions—as a single atomic EditHistory transaction reverted by one u (Ctrl+R to redo).
| Operator / Key | Action |
|---|---|
d{motion/textobj}, dd
|
Delete span or [count] lines into target register |
c{motion/textobj}, cc
|
Delete span or [count] lines (preserving leading indent on cc) and enter Insert mode |
y{motion/textobj}, yy, Y
|
Yank span or [count] lines into target register (populating "0 when unnamed) |
>{motion/textobj}, >> / <{motion/textobj}, <<
|
Indent / dedent covered non-empty lines by tab_width
|
gU{motion}, gUU / gu{motion}, guu / g~{motion}, g~~
|
Uppercase / lowercase / toggle ASCII case across span or line |
x, X, s, S, D, C
|
Delete char forward (x), backward (X), substitute char/line (s/S), delete to EOL (D), change to EOL (C) |
r<ch>, ~, J
|
Replace [count] chars on line with <ch>, toggle case under cursor (~), join lines (J) |
., [count].
|
Dot-repeat last buffer-mutating command (or Insert session) as one undo transaction, optionally overriding its count (3.) |
Text objects work after any operator (diw, ci", >i{, daf) and inside Visual mode (viw, vif, vac):
| Text Object | Inner (i) vs. Around (a) Target |
|---|---|
iw / aw, iW / aW
|
Inner word / WORD, or word / WORD plus adjacent horizontal whitespace |
i" / a", i' / a', i` / a`
|
Quoted string contents vs. quotes included (honoring \" / \' escapes and forward same-line lookup) |
i( / a( (ib/ab), i[ / a[, i{ / a{ (iB/aB), i< / a<
|
Balanced nested parentheses, brackets, braces (linewise inner body on multiline { ... }), and C++ template <...>
|
if / af
|
AST Function / Method (TreeSitterService::ancestorsAtByteOffset): function body vs. full function definition |
ic / ac
|
AST Class / Struct: inner class/struct body vs. full declaration (including trailing ;) |
il / al
|
AST Loop: inner for / while / do loop body vs. entire loop construct |
-
Registers & Paste (
p/P):-
""(unnamed default),"0(most recent yank, untouched byd/c/x),"a–"z(named registers),"A–"Z(append to named register),"_(black-hole discard), and"+/"*(system clipboard viaQGuiApplication::clipboard()). -
ppastes characterwise after the cursor or linewise below the current line;Ppastes before the cursor or above the current line.
-
-
Macros (
q/@/@@):- Press
q<a-z>inNormalmode to record keystrokes acrossNormal,Visual, andInsertmodes (q<A-Z>appends to an existing macro); pressqinNormalmode to finish. - Replay with
@<reg>,[count]@<reg>, or@@(repeat last played macro); each macro invocation groups its edits into a single undo transaction.
- Press
-
Visual Block (
Ctrl+V):- Press
Ctrl+Vand extend a rectangular column box withh/j/k/l(backed directly bySelectionSet::setBoxSelection). - Press
I<text><Esc>to insert<text>before the block on every selected line,A<text><Esc>to append after the block on every line,c<text><Esc>to replace the block across all lines,d/xto delete the column block, oryto yank it.
- Press
Press : in Normal or Visual mode to open VimExCommandBar at the bottom of the active editor (Up / Down cycles command history; Esc or Ctrl+[ cancels):
| Ex Command | Effect |
|---|---|
:w / :write [<path>]
|
Saves the buffer to disk (or writes to <path>) |
:q / :quit, :q! / :quit!
|
Closes the active editor tab when unmodified (:q) or unconditionally (:q!) |
:wq / :x
|
Saves the buffer and closes the active editor tab |
:<N>, :$
|
Jumps directly to 1-based line <N> or the last line of the buffer |
:s/pat/rep/[gi], :%s/pat/rep/[gi], :<a,b>s/pat/rep/[gi]
|
Performs regex/literal substitution on the current line, entire buffer (%), or line range <a,b> (supporting \0, \1–\9, &, \n, \t, g global, and i case-insensitive flags) in one undoable EditHistory transaction |
:noh / :nohlsearch
|
Dismisses active search match highlights |
:set vim, :set novim, :set vim!
|
Enables, disables, or toggles editor.vim_mode
|
GridLock Repository | Releases | Report an Issue | Roadmap | Accessibility | License (MIT)
Documentation mirrored from docs/ on master.
Getting Started & Tutorials
Debugging Workflows
- UI & Debugging Manual
- View Modes & Layout
- Build & Find in Files
- Server Rack View
- MPI Diagnostics & HPC
- OpenMP OMPD Inspector
- Memory, RE & Profiling
- Struct Layout & Cache Lines
- Reference Manual & Packages
Customization & Reference
- Configuration & Themes
- Vim Modal Editing
- Keyboard Shortcuts
- GDB Reference & Cheat Sheet
- Screenshot Gallery
- Engineering Roadmap
Extending & Architecture