Vix™ for Vim users
You think in motions and you have a .vimrc you have tended for years. This
page is for trying Vix without giving that up: a ten-minute exercise you run on
a real (tiny) project, then an exact account of which Vim keys behave the same,
which behave differently, and what Vix adds on top. Every parity claim here
comes from one table that CI runs against Vix on every change and against an
unconfigured Vim in a separate job, so the page cannot quietly drift from what
the editor does.
Turn on the Vi keymap
Set keymap = "vi" in config.toml, or pick View -> Keymap -> Vi (or open
the command palette with Ctrl+P and type keymap). The status bar shows
-- NORMAL --. The Spacemacs keymap is the same Vi Normal mode plus a
Space leader with a which-key popup.
Three kinds of behavior
The rest of this page keeps these apart:
- Stock Vim: keys that mean the same in an unconfigured Vim (
vim -u NONE, no plugins). Rows of this kind in the table are checked against a real Vim. - Optional Vix: things Vix adds that a stock Vim has no keys for: Tree-sitter
text objects (
cia,daf,]f), the undo tree view, menus and the command palette. In Vim each of these is a plugin you would install and configure. - External tools: behavior that runs another program. Test at point runs
cargo test(or your project’s test runner), staging a hunk runsgit, and:cnwalks the problems parsed from a task’s output, much as Vim’s:makefills the quickfix list throughmakeprganderrorformat.
A ten-minute migration exercise
The repository ships a tiny Rust crate with one bug in two places,
tui/examples/vim-exercise. It needs only cargo and git and no network.
Copy it out and make it a git repository, so the last step has something to
stage:
cp -R tui/examples/vim-exercise /tmp/vim-exercise
cd /tmp/vim-exercise && git init -q && git add -A && git commit -qm start
vix src/lib.rs # with keymap = "vi"
The automated test tui/tests/integration/vim_exercise.rs types exactly these
keys into Vix, runs the real cargo and git, and checks every step’s result.
- Run the test at point.
/a_quarter<CR>puts the cursor on the testa_quarter_is_25_percent(stock Vim keys). Then Project -> Test at Point runs just that test (external tool:cargo test -- --exact tests::a_quarter_is_25_percent). It fails:percent(1, 4)is2, not25. - Jump to the failure.
:cn<CR>goes to the first problem the run reported, the failingassert_eq!on line 24 (the panic location is parsed from the test output, like Vim’s quickfix list). - Edit the argument.
gg/10<CR>finds the wrong scale, andciw100<Esc>changes it (stock Vim). With a Tree-sitter grammar,ciachanges the whole argument whatever it looks like (optional Vix). - Repeat.
n.finds the same mistake inpercent_labeland repeats the change (stock Vim). - Take a detour through the undo tree.
uundoes the repeat, and0f1ciw50<Esc>makes a different change instead: the undo history now has two branches. Edit -> Undo Tree… shows them;Uppreviews the other branch live (both scales100),Enterkeeps it andEscwould put everything back (optional Vix: Vim keeps the same tree and walks it withg-/g+, which Vix’s Vi keymap has too, and:undolist, but draws it only with a plugin). - Rerun the test.
:w<CR>, thengg/a_quarter<CR>and Project -> Test at Point again: it passes. - Stage the fix.
:6<CR>and Git -> Stage Hunk, then:11<CR>and Git -> Stage Hunk stage the two changed lines (external tool:git);git diff --cachedin a shell shows both.
The parity table
Each row is a key sequence typed into a fresh buffer: the buffer before and
after (¦ is the cursor, ⏎ a line break; every buffer ends in a line break,
not shown), the mode afterwards, and the row’s kind. For a stock-Vim row the last
column says whether an unconfigured Vim does the same; where it does not, it
gives Vim’s result and why, and the “After in Vix” column is what Vix does
today. The rows put deletions and yanks in register a ("a), which Vix and
Vim share; the unnamed register is the system clipboard in Vix.
The table lives in tui/tests/integration/vim_parity.rs; this section is
generated from it (VIX_UPDATE_VIM_PARITY=1 cargo test -p vix-tui --lib vim_parity), and the CI job that runs stock_rows_match_an_unconfigured_vim
fails if Vim stops agreeing with a row.
| Keys | Before | After in Vix | Mode | Kind | Same in Vim? |
|---|---|---|---|---|---|
3l | ¦hello world | hel¦lo world | Normal | stock Vim | yes |
$ | ¦hello | hell¦o | Normal | stock Vim | yes |
0 | ab¦c | ¦ abc | Normal | stock Vim | yes |
^ | ab¦c | ¦abc | Normal | stock Vim | yes |
w | ¦pkg::run(arg); | pkg¦::run(arg); | Normal | stock Vim | yes |
3w | ¦pkg::run(arg); | pkg::run¦(arg); | Normal | stock Vim | yes |
b | foo ba¦r | foo ¦bar | Normal | stock Vim | yes |
e | ¦foo bar | fo¦o bar | Normal | stock Vim | yes |
W | ¦a.b c | ¦a.b c | Normal | stock Vim | no: Vim gives a.b ¦c. WORD motions (W B E) are not implemented: the key does nothing |
gg | one⏎two⏎th¦ree | ¦one⏎two⏎three | Normal | stock Vim | yes |
G | ¦one⏎two⏎three | one⏎two⏎¦three | Normal | stock Vim | yes |
2G | ¦one⏎two⏎three | one⏎¦two⏎three | Normal | stock Vim | yes |
4ljj | ¦abcdef⏎x⏎abcdef | abcdef⏎x⏎abcd¦ef | Normal | stock Vim | yes: the column is kept across a shorter line |
2f. | ¦a.b.c | a.b¦.c | Normal | stock Vim | yes |
t. | ¦ab.c | a¦b.c | Normal | stock Vim | yes |
F. | a.b.¦c | a.b¦.c | Normal | stock Vim | yes |
T. | a.b.¦c | a.b.¦c | Normal | stock Vim | yes |
f.; | ¦a.b.c | a¦.b.c | Normal | stock Vim | no: Vim gives a.b¦.c. ; and , (repeat the last f/t) are not implemented |
} | ¦one⏎two⏎⏎three | one⏎two⏎¦⏎three | Normal | stock Vim | yes |
{ | one⏎⏎two⏎th¦ree | one⏎¦⏎two⏎three | Normal | stock Vim | yes |
) | ¦One. Two. | One. ¦Two. | Normal | stock Vim | yes |
% | ¦(a [b] c) | (a [b] c¦) | Normal | stock Vim | yes |
* | ¦foo bar foo | ¦foo bar foo | Normal | stock Vim | no: Vim gives foo bar ¦foo. * and # are not implemented |
/bar<CR> | ¦foo bar | foo ¦bar | Normal | stock Vim | yes: / opens Vix’s find bar |
/o<CR>n | ¦xo o | xo ¦o | Normal | stock Vim | yes |
/bar<CR>"ax | ¦foo bar | foo ¦ar | Normal | stock Vim | yes: <CR> closes the find bar and returns to Normal mode |
/bar<CR><Esc>"ax | ¦foo bar | foo ¦ar | Normal | stock Vim | yes |
"adw | ¦foo bar | ¦bar | Normal | stock Vim | yes |
"ade | ¦foo bar | ¦ bar | Normal | stock Vim | yes |
"add | ¦one⏎ two | ¦two | Normal | stock Vim | yes |
"a2dd | ¦one⏎two⏎three | ¦three | Normal | stock Vim | yes |
"adw | foo ¦bar⏎baz | foo¦ ⏎baz | Normal | stock Vim | yes: dw on a line’s last word keeps the line break |
"ad$ | fo¦o bar | f¦o | Normal | stock Vim | yes |
"aD | fo¦o bar | f¦o | Normal | stock Vim | yes |
"ax | ¦abc | ¦bc | Normal | stock Vim | yes |
"a3x | ¦abcd | ¦d | Normal | stock Vim | yes |
"aX | ab¦c | a¦c | Normal | stock Vim | yes |
"adf. | ¦a.b.c | ¦b.c | Normal | stock Vim | yes |
"a2d3w | ¦a b c d e f g h | ¦g h | Normal | stock Vim | yes: the two counts multiply |
"adj | ¦one⏎two⏎three | ¦three | Normal | stock Vim | yes |
"adG | one⏎¦two⏎three | ¦one | Normal | stock Vim | yes |
"acwX<Esc> | ¦foo bar | ¦X bar | Normal | stock Vim | yes |
"accX<Esc> | fo¦o⏎bar | ¦X⏎bar | Normal | stock Vim | yes: an unconfigured Vim has noautoindent, so neither keeps the indent |
"aCX<Esc> | fo¦o bar | fo¦X | Normal | stock Vim | yes |
"asX<Esc> | ¦abc | ¦Xbc | Normal | stock Vim | yes |
rX | ¦abc | ¦Xbc | Normal | stock Vim | yes |
2rX | ¦abc | X¦Xc | Normal | stock Vim | yes |
4rX | ¦abc | ¦abc | Normal | stock Vim | yes: too few characters left: nothing happens |
r<CR> | a¦bcd | a⏎¦cd | Normal | stock Vim | yes |
2r<CR> | a¦bcd | a⏎¦d | Normal | stock Vim | yes: {count}r<CR> replaces the characters with one line break |
r<CR>j. | a¦bc⏎def | a⏎c⏎⏎¦ef | Normal | stock Vim | yes |
~ | ¦abc | ¦abc | Normal | stock Vim | no: Vim gives A¦bc. ~ is not implemented |
J | ¦one⏎two | one¦ two | Normal | stock Vim | yes |
3J | ¦one⏎ two⏎)three | one two¦)three | Normal | stock Vim | yes: leading white space goes; no space before ) |
>> | ¦one | ¦one | Normal | stock Vim | no: Vim gives ¦one. > and < are not implemented |
"ayy"ap | ¦one⏎two | one⏎¦one⏎two | Normal | stock Vim | yes |
"ayw"aP | ¦foo bar | foo¦ foo bar | Normal | stock Vim | yes |
"ayl"a3p | ¦ab | aaa¦ab | Normal | stock Vim | yes |
"ayiw | foo b¦ar | foo ¦bar | Normal | stock Vim | yes |
"adiw | foo b¦ar baz | foo ¦ baz | Normal | stock Vim | yes |
"adaw | foo b¦ar baz | foo ¦baz | Normal | stock Vim | yes |
"adi( | f(a, ¦b) | f(¦) | Normal | stock Vim | yes |
"adib | f(a, ¦b) | f(¦) | Normal | stock Vim | yes |
"ada" | say "h¦i" now | say ¦now | Normal | stock Vim | yes |
"ada" | say "h¦i" | sa¦y | Normal | stock Vim | yes: no white space after the quote: the white space before it goes |
"aci{X<Esc> | { a¦b } | {¦X} | Normal | stock Vim | yes |
"adi<lt> | <a¦b> | <¦> | Normal | stock Vim | yes |
"adip | one⏎tw¦o⏎⏎three | one⏎tw¦o⏎⏎three | Normal | stock Vim | no: Vim gives ¦⏎three. ip/ap and is/as are not implemented: the operator is cancelled |
v | ¦abc | ¦abc | Visual | stock Vim | yes |
V | a¦bc | a¦bc | Visual Line | stock Vim | yes |
Vj | a¦bc⏎de | abc⏎d¦e | Visual Line | stock Vim | yes |
vll"ad | ¦hello | ¦lo | Normal | stock Vim | yes |
Vj"ad | ¦one⏎two⏎three | ¦three | Normal | stock Vim | yes |
viw"ay | foo b¦ar | foo ¦bar | Normal | stock Vim | yes |
"avlld | ¦hello | ¦lo | Normal | stock Vim | no: Vim gives ¦lo. same text, but a "a typed before v selects the register in Vix; Vim drops it and writes the unnamed register |
vw"ad | ¦foo bar | foo ¦ar | Normal | stock Vim | no: Vim gives ¦ar. Visual mode moves with h j k l only: w moves the cursor and drops the selection |
vl"ad. | ¦abcdef | ¦cdef | Normal | stock Vim | no: Vim gives ¦ef. a Visual operator is not dot-repeatable: . does nothing |
"adw. | ¦a b c | ¦c | Normal | stock Vim | yes |
"a2dw3. | ¦a b c d e f g | ¦f g | Normal | stock Vim | yes: a count before . replaces the recorded one |
"ax. | ¦abc | ¦c | Normal | stock Vim | yes |
"aciwX<Esc>w. | ¦foo bar | X ¦X | Normal | stock Vim | yes |
A;<Esc>j. | ¦one⏎two | one;⏎two¦; | Normal | stock Vim | yes |
ofoo<Esc>. | ¦top | top⏎foo⏎fo¦o | Normal | stock Vim | yes |
"arX. | ¦abc | ¦Xbc | Normal | stock Vim | yes: . repeats r where the cursor is |
J. | ¦a⏎b⏎c | a b¦ c | Normal | stock Vim | yes |
iX<Esc> | ab¦c | ab¦Xc | Normal | stock Vim | yes |
aX<Esc> | ¦abc | a¦Xbc | Normal | stock Vim | yes |
AX<Esc> | ¦abc | abc¦X | Normal | stock Vim | yes |
IX<Esc> | a¦bc | ¦Xabc | Normal | stock Vim | yes |
oX<Esc> | ¦one⏎two | one⏎¦X⏎two | Normal | stock Vim | yes |
OX<Esc> | one⏎¦two | one⏎¦X⏎two | Normal | stock Vim | yes |
i<Esc> | ¦abc | ¦abc | Normal | stock Vim | yes: never steps back past the line’s start |
iX | ab¦c | abX¦c | Insert | stock Vim | yes |
iXY<BS><Esc> | ¦c | ¦Xc | Normal | stock Vim | yes |
"ax"axu | ¦abc | ¦bc | Normal | stock Vim | yes |
"aciwXY<Esc>u | ¦foo bar | ¦foo bar | Normal | stock Vim | yes: one u undoes the whole change |
"axu<C-r> | ¦abc | ¦bc | Normal | stock Vim | yes |
"ax"ax2u2<C-r> | ¦abc | ¦c | Normal | stock Vim | yes |
"ax"axuug+ | ¦abc | ¦bc | Normal | stock Vim | yes |
"axul"axg- | a¦bcd | a¦cd | Normal | stock Vim | yes: g- walks back in time across undo branches, where u would not |
:2<CR> | ¦one⏎two | one⏎¦two | Normal | stock Vim | yes |
:s/o/0/<CR> | ¦foo | ¦f0o | Normal | stock Vim | yes |
:s/o/0/g<CR> | ¦foo | ¦f00 | Normal | stock Vim | yes |
:%s/a/b/g<CR> | ¦a⏎a | b⏎¦b | Normal | stock Vim | yes |
:s/./X/<CR> | ¦a.b | ¦a.b | Normal | stock Vim | no: Vim gives ¦X.b. :s takes literal patterns only and refuses Vim pattern syntax such as ., leaving the buffer unchanged |
"aciaX<Esc> | fn f(a: u8, ¦b: u8) {} | fn f(a: u8, ¦X) {} | Normal | optional Vix | n/a: Tree-sitter argument object (a plugin in Vim) |
"adaf | fn a() {}⏎fn ¦b() {} | fn a() {}⏎¦ | Normal | optional Vix | n/a: Tree-sitter function object (a plugin in Vim) |
]f | ¦fn a() {}⏎fn b() {} | fn a() {}⏎¦fn b() {} | Normal | optional Vix | n/a: Tree-sitter next-function motion (a plugin in Vim) |
:cn<CR> | ¦one⏎two | one⏎t¦wo | Normal | external tool | n/a: after a task printed a.txt:2:2: error: boom (Vim: :make with a makeprg) |
Known differences, in short
From the table, the places where Vix’s Vi keymap does not yet do what Vim does:
- Search.
*and#are not implemented. - Keys not bound yet:
WBE,;,,~,><, and theip/ap/is/asobjects. - Visual mode moves with
hjkland the arrows only, its operators are not dot-repeatable, and a register typed beforevapplies to the Visual operator (Vim ignores it). There is no Visual Block. - Ex.
:stakes literal patterns only and refuses Vim pattern syntax. - Beyond the table: no uppercase, numbered or special registers, no
q/@register macros (Vix records macros from the Edit menu), no Vimscript, andccdoes not keep indentation (an unconfigured Vim, withnoautoindent, does not either).crates/vix-modal/spec/index.mdkeeps the exact line.
Where Vix goes further
- Built in, not assembled. LSP, a debugger, Tree-sitter highlighting and text objects, fuzzy finding, git hunk staging, a terminal, a test runner and a drawn undo tree are menu items that already work. In Vim each is a plugin (or several) to choose, install and configure.
- Discoverable from the keyboard. Menus (
F10), a command palette (Ctrl+P,>for commands) andF1for every shortcut;:still works. - Persistent undo by default. The undo tree survives closing the file,
guarded by a content hash. Vim keeps a tree too, and
undofilepersists it. - Safety. Rust and
#![forbid(unsafe_code)]. The one embedded script runtime, Rhai, is sandboxed: a script cannot read files, open sockets or start processes, and a project’s own scripts run only after you trust the workspace.
Where Vim still wins
- The full Vi language, as the list above shows.
- Extensibility. No Vimscript and no Lua. Rhai scripts (and git
repositories of them installed with
vix --plugin) add commands, key bindings and buffer transforms, but there is nothing like Vim’s plugin ecosystem: if your workflow depends on a niche plugin, Vix cannot replace it today. - Ubiquity. Vim is on every server you will ssh into; Vix is a single static binary you bring along.
- Maturity. Vim has decades of edge cases handled. Vix is young.
See also
docs/keymaps/index.md: every keymap, every binding.crates/vix-modal/spec/index.md: the modal engine’s spec and its cut list.crates/vix-keymap-model/spec/index.md: the keymap spec.index.md: the full feature tour.
Vix™ and Vix IDE™ are trademarks.