vi Keys

The following vi keys are supported for navigating and editing, after setting vi Mode in the options.

key action
single char commands
ainsert after cursor
bleft one word
eword right end
gstart of document
hleft one character
iinsert before cursor
jdown one line
kup one line
lright one character
nrepeat the most recent search, in the same direction
oinsert after line
pput after cursor
qstop macro recording
uundo
venter visual mode
wright one word
xdelete
spaceright one character
Ainsert after end of line
Bleft one word (same as b)
Cchange to end of line
Ddelete line right
Eword right end (same as e)
Ggoto end or line number if prefixed
Hgoto first line of the screen
Iinsert at begin
Jjoin lines
Lgoto last line of the screen
Mgoto middle line of the screen
Nrepeat the most recent search, in the opposite direction
Oinsert before line
Pput before cursor
Rreplace many chars, enters overtype mode
Venter visual line mode
Wright one word (same as w)
Xdelete backwards
/next occurrence
?previous occurrence
.repeat last action
;repeat last find char
~toggle case
$end of line
0,^begin of line
{paragraph up, in visual mode adds to selection
}paragraph down, in visual mode adds to selection
(paragraph up, in visual mode adds to selection (same as {)
)paragraph down, in visual mode adds to selection (same as })
%matching brace, in visual mode selects with matching brace
#previous occurrence of word under cursor
*next occurrence of word under cursor
+down one line, goto home
-up one line, goto home
tabindents selection
TABdedents selection
ESCescape deselects, goes back to normal mode
key action
control char commands
ctrl bpage up
ctrl eincrement word under cursor
ctrl fpage down
ctrl gshows filename and state
ctrl jdecrement word under cursor
ctrl pscroll up
ctrl qscroll down
ctrl r?inserts contents of register if in insert mode
ctrl r%inserts contents of % register, or copies contents to clipboard if not in insert mode
ctrl r=enters register calculation mode
double or more char commands
ccchange line
cwchange word
dddelete line or selection
dedelete word (to end of word)
d0delete line left
d$delete line right
dwdelete word
f?find next character
F?find previous character
m?mark current line (one letter marker)
qxrecord macro x
qXrecord macro x (appends to x)
@xplays back macro x (one char)
@xx@plays back macro xx (several characters)
@@plays back last macro
r?replace current character only
t?find next character, caret before pos
T?find previous character, caret before pos
ywyank word
yyyank line or selection
ZZsave and quit
zcfold close
zofold open
zEfold disable
zffold enable
'?goto marker
"?prepares register to receive contents of yy, yw, de, dd, dw, d0, d$
>>increase indent for current line, selection or visual area
<<decrease indent for current line, selection or visual area
key action
colon commands
:.= current line
:$ goto end of document
:close closes current document
:d delete current line
:e edit (show select file dialog)
:e * edit file * (with tab expansion)
:n next
:prev previous
:q quit unless modified
:q! quit forced
:r * insert contents of file * below cursor
:r !commandexecutes command and inserts output below cursor
:[range]>increase indent for range
:[range]<decrease indent for range
:[range]d delete range
:[range]mx move range to destination address x
:[range]s/p/r/[flags]substitutes in range p by r using flags
:[range]!command filters range, range is used as input for command, output replaces range
:reg shows registers
:set ic sets ignore case
:set ic! sets match case
:set list shows whitespace
:set list! hides whitespace
:set nu shows line numbers
:set nu! hides line numbers
:set ts=no sets tabstop at every no
:set tabstop=no sets tabstop at every no
:w save
:w * save to file *
:x save and quit
:y yank current line
:!commandexecutes command and shows output
global commands
:g//remove all markers
:g/pattern/ddelete lines containing pattern
:g/pattern/mark lines containing pattern
:g/pattern/pprint lines containing pattern, the lines are put on a new tab pane called Print
:g/pattern/s/replacementsubstitute pattern by replacement

[range]

chars range
%entire document
*visible area
'<,'>visual (selected) area
.current line only
x,yline x to y (x,y can be a ., $, marker, or line no)

[register]

name purpose explanation
%filename registercurrent filename
_black hole registeranything written to it is not kept
"clipboard registercontents of clipboard
0yank registerlast yank value
1 - 9delete registersqueue of 9 last deleted values
a - zstandard registernormal register

[flags]

char purpose
iignore case
cask for confirmation
gglobal, otherwise only first match on line

When substituting you can use & or \0 to represent the target, and \U to convert to uppercase and \L to convert to lowercase.

Most commands can be prefixed with a multidigit number, that takes care of repeating that command the number specified.