Is there any documentation on which commands are supported for vim mode now? I know there's the help bar (though I haven't seen it appear since yesterday...). Is there vimrc support, etc...?
Xcode 13 vim mode documentation?
Yah, same question here. I'm so excited to to see what a builtin support for vim would be like, and how can users do the basic vimrc stuff as well as access XCode command to map keys to Xcode functions
Thanks
to enable Preferences → Text Editing → Editing → Enable Vim key bindings.
We are working on publishing an article about Vim key bindings. Until the official article is out, here is the brief list of Vim commands supported in Xcode 13 beta.
Normal Mode Commands
- Motion Commands: (h, ←), (l, →), (⌫, ⌃h), <space>, (0, ↖), ($, ↘), (g0, g↖), (g$, g↘), ^, g_, g^, F{character}, f{character}, T{character}, t{character}, ;, <comma>, (k, ⌃p, ↑), (j, ⌃j, ⌃n, ↓), (gk, g↑), (gj, g↓), _, -, (+, ↩, ⌃m), (gg, ⌃↖), G, ⌃↘, %, (b, ⇧←), (w, ⇧→), (B, ⌃←), (W, ⌃→), ge, e, gE, E, {, }, %, H, M, L, ⇥, ⇧⇤
- Scrolling Commands: ^y, ^e, ^u, ^d, (⌃b, ⇧↑, ⇞), (⌃f, ⇧↓, ⇟), z↩, zt, zz, z., z-, zb
- Insert and Replace Commands: a, A, (i, <insert>), I, o, O
- Deleting Text Commands: ["x]X, (["x]x, ["x]⌦), ["x]dd, ["x]d{motion}, D, J, gJ, ["x]c{motion}, (["x]cc, ["x]S), ["x]C, ["x]s
- Simple Changes Commands: <<, >>, ~
- Copying and Moving Text Commands: ["x]yy, ["x]y{motion}, ["x]Y, ["x]p , ["x]P
- Undo and Redo Commands: (u, <undo>), ⌃r
- Visual Commands: v, V, ^v
- Search Commands: ?, /, E, , gE, g, n, N
Visual Mode Commands
- Motion Commands: ;, <comma>, ⇥, ⇧⇤, (h, ←), (l, →), (⌫, ⌃h), <space>, (0, ↖), ($, ↘), (g0, g↖), (g$, g↘), ^, g_, g^, F{character}, f{character}, t{character}, T{character}, (k, ⌃p, ↑), (j, ⌃j, ⌃n, ↓), (gk, g↑), (gj, g↓), (b, ⇧←), (w, ⇧→), (B, ⌃←), (W, ⌃→), ge, e, gE, E, H, M, L
- Text Object Selection Commands: aw, iw, aW, iW, (a[, a]), (i[, i]), (a(, a), ab), (i(, i), ib), (a<, a>), (i<, i>), (a{, a}, a😎 , (i{, i}, i😎 , a", i", a', i', a
, i
- Deleting Text Commands: (["x]x, ["x]d, ["x]⌦), (["x]c, ["x]s)
- Copying and Moving Text Commands: ["x]y, ["x]Y
- Visual Commands: v, V, ^v, o
- Search Commands: n, N, #, , g#, g
Insert Mode Commands
- Insert and Replace Commands: ^r{register}
vi support is a breath of fresh air in Xcode 13 -- thank you for the update!
I have to train my fingers on a few things (doesn't do any good to type ":w" reflexively now), but there are two key bindings I find I miss a little: to repeat the last command and "m" for marking.
I can understand why the mark command isn't present and there are probably better ways to do what I routinely use it for anyway. But adding the command would be much appreciated if you're taking feedback. 😎
Eric
Sorry -- looks like the editor stripped out the text <period>
before "to repeat the last command" and in the middle of "adding the command" in my prior message.
This is great. I've noticed that some visual modes aren't implemented, in particular visual block mode and visual line mode.
ignore - moved to comment on other answer
With Xcode 13 beta 3, the enabling seems to have moved to Editor -> Vim Mode
Putting in a vote for gd
, to jump to definition ❤️
Delighted to finally have vi functionality and thanks for adding it because it is the one thing I hated about Xcode, but unfortunately it does still need a bit of work on some features.
There also appears to be a fault with "d", because "dw" should delete to the end of the current word, but it seems to delete the whole line?
One hugely important feature that appears to be missing is the ability to press "." to repeat the last action.
I agree with other posters that "m" should be there.
Wishing to update my comment above, rather than leave it as a sub-posting that might be missed:
If you use dw to deletes the last word on a line (with no punctuation following it) then it will delete the whole of that line and the line below it.
Also if you search using / and find a word but then step back before that word when you press n it skips the word.
For example create the line:
my big test test
Search for the word test using /test and the first time it might take you to the first or second occurrence of the word "test", but if you then move the pointer back to the start of the line (or even further up the document) and then press n it moves the pointer to the start of the second occurrence of "test" not the first. In my tests pressing 'n' always seems to skip the first occurrence and jump to the second, but then if you press n again it will loop round to the first occurrence.
Is there any plan to allow customizing the keybindings?
Also agree that this is an awesome update. My wish list:
- vimrc to allow custom keybindings for insert mode escape sequences and pane naviagtion
gd
- dot operator
- Goto Line number command + visual mode highlight
Thank you to all involved!
The missing feature I want the most is support for the period key to repeat the last command. For example, I frequently execute something like "cwfoo" to change the word under the cursor to "foo". Then I want to move somewhere else in the file and press "." to repeat that command.
Is vim mode still only available in the Xcode Beta? I can't find the mentioned setting in Xcode 13.1.