Skip to content

Key reference

Every binding, by mode. :help inside the editor prints a one-line version of this.

Normal mode

Motions

Key
h j k l left, down, up, right
← ↓ ↑ → the same
w b e word forwards, back, to the end of one
W B E the same, punctuation counted as part of the word
0 the first column
^ the first non-blank
$ the end of the line
+ Enter-ish - first non-blank of the next line, of the previous
Space forward one character
_ the first non-blank of this line
gg G the first line, the last
{ } back and forward a paragraph
fc Fc to the next c on this line, or the previous
tc Tc to just before it, either way
% to the bracket matching the next one on this line
`a 'a to mark a: the character, or the line's first non-blank

Paging and scrolling

Key
Ctrl+F Ctrl+B forward, back a screenful
PgDn PgUp the same
Ctrl+D Ctrl+U half a screenful
Ctrl+E Ctrl+Y move the view, not the cursor

Operators

Key
d c y delete, change, yank
> < indent, outdent
dd cc yy >> << the same, on the whole line

Each takes a count on either side and a motion or text object after: d2w, 2dw, ci", y}.

Text objects

Key
iw aw iW aW a word, inner or around
i( a( i) a) ib ab parentheses
i{ a{ i} a} iB aB braces
i[ a[ i] a] brackets
i" a" i' a' i` a`

Single-key edits

Key
x X delete the character under the cursor, or before it
D C delete, change to the end of the line
s S substitute the character, the line
rc replace the character with c
~ swap its case
J join the next line on
Y yank the whole line — vi's Y is yy, not y$
p P put after the cursor, before it
o O open a line below, above

Entering insert mode

Key
i I before the cursor, before the first non-blank
a A after the cursor, at the end of the line
o O on a new line below, above

Undo, repeat, macros, marks

Key
u undo
Ctrl+R redo
. repeat the last change
qa … q record keystrokes into register a
@a play them; 3@a three times
@@ play the last one again
ma put mark a here
`a 'a go to it
`` back to where the last jump started

Registers

Key
"x send the next command's text to register x
"+y "+p the system clipboard; "* is the same

Visual mode

Key
v select characters
V select lines
Esc stop

Any motion extends the selection; any operator applies to it.

Key
/ ? search forwards, backwards
n N the next match, the previous
Ctrl+P the fuzzy file picker
Ctrl+G find in project
Ctrl+W then w the next window
Ctrl+W then h j k l the window left, down, up, right
Ctrl+W then s v split horizontally, vertically
Ctrl+W then c q close this window
Ctrl+W then o close every other one
ZZ write and quit
: the command line
Ctrl+C says type :q to exit; it does not quit

The mouse belongs to your terminal

What you get

TurboVI does not turn on mouse reporting, so the pointer does what it does everywhere else: double-click a word, triple-click a line, drag to select, Cmd+C to copy, and paste it into another application.

That is a choice, and it is one or the other. Mouse reporting is a mode of the terminal, not a feature of a program: switching it on hands this editor click coordinates and takes selecting and copying away from the terminal, because the terminal no longer sees the clicks. Placing the cursor with a click is worth less than being able to copy a line out, so the mouse stays where it was.

Copying a line without its number

A terminal selects rectangles of the screen, and the gutter is part of the screen, so an ordinary drag takes the line numbers with the text. Hold Option while you drag — iTerm2 and Terminal.app both read that as a rectangular selection — and you can start it at the first column of the text and leave the numbers behind.

Or turn them off. :set nonu for this session, or set nonu in $XDG_CONFIG_HOME/turbovi/config for good, which is vi's own default and makes every drag clean.

Scrolling

The wheel scrolls the way your terminal scrolls an alternate-screen program, which in iTerm2 and Terminal.app means it sends ↑ and ↓ and moves the cursor. Ctrl+E and Ctrl+Y move the view without the cursor, and Ctrl+F and Ctrl+B go by the screenful.

Pasting from outside

Cmd+V, Ctrl+Shift+V, middle click — whatever your terminal pastes with — inserts the text, in any mode. It arrives as one paste rather than as a key press per character, which is what makes a big one instant instead of taking seconds.

Because it arrives as a paste, the characters are text rather than commands: pasting dd in normal mode types dd instead of deleting a line, and one u takes the whole paste back.

"+p is the other way in, and the one a macro can use.

Insert mode

Key
Esc back to normal mode
Enter split the line
Backspace delete backwards
Tab insert what the file indents with (see settings)
← ↓ ↑ → move without leaving insert mode

There are no other commands in insert mode: everything else you press is text.

The command line

Key
Enter run it
Esc abandon it
Backspace delete backwards; on an empty line, abandon

The find dialog

Key
↑ ↓ move through the hits
PgUp PgDn a windowful at a time
Enter open the hit, fill the quickfix list
Esc close
Ctrl+A ignore case
Ctrl+W whole words
Ctrl+R regular expression, on by default

The quickfix pane

Key
Enter go to the entry under the cursor

Everything else is an ordinary buffer, so the motions all work.