vi Keys

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

ainsert after cursor
bmove left one word
emove word right end
gstart of document
hmove left
iinsert before cursor
jmove down
kmove up
lmove right
nrepeat the most recent search, in the same direction
oinsert after line
pput after cursor
qstop macro recording
uundo
venter visual mode
wmove right 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 from original search
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 })
[move to previous "{...}" section
]move to next "{...}" section
%matching brace, in visual mode selects with matching brace
#previous occurrence of word under cursor
*next occurrence of word under cursor
+move to first character on the next line
-move to first character on the previous line
|goto column number specified by prefix
tabindents selection
TABdedents selection
ESCescape deselects, goes back to normal mode
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 ?
ctrl r%inserts contents of % register, or copies contents to clipboard if not in insert mode
ctrl r=enters register calculation mode
ccchange line
cwchange word
dddelete line or selection
dedelete word (to end of word)
d0delete line left
d$delete line right
dggdelete from start of the file until current line
dGdelete from current line until end of the file
dwdelete word
f?find next character
F?find previous character
gggoto begin
m?mark current line (one letter marker)
qxrecord macro x
qXrecord macro x (appends to x)
@xplays back macro x (register)
@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 ?
"xprepares register x for p, yy, yw, de, dd, dw, d0, d$
"Xappends contents of yy, yw, de, dd, dw, d0, d$ to register x
>>increase indent for current line, selection or visual area
<<decrease indent for current line, selection or visual area
:.= 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 syntax=lexer sets lexer
:set ts=no sets tabstop at every no
:set tabstop=no sets tabstop at every no
:syntax on use syntax highlighting
:syntax off stops syntax highlighting
:w save
:w * save to file *
:x save and quit
:y yank current line
:!commandexecutes command and shows output
: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]

%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]

.insert registerlast inserted text
0yank registerlast yank value
1 - 9delete registersqueue of 9 last deleted values
a - zstandard registersnormal register
*clipboard registercontents of clipboard
%filename registercurrent filename
_black hole registeranything written to it is not kept

[flags]

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. You can use a $ to match a line end, e.g. %s/$/EOL appends the string EOL at the end of each line. Merging is not yet possible using a \n target, you can create a macro for that. You can use ~ to match against a previous replacement string.

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

Replace uses regular expressions from scintilla:

.Matches any character
\(This marks the start of a region for tagging a match.
\)This marks the end of a tagged region.
\nWhere n is 1 through 9 refers to the first through ninth tagged region when replacing. For example, if the search string was Fred\([1-9]\)XXX and the replace string was Sam\1YYY, when applied to Fred2XXX this would generate Sam2YYY. \0 refers to all of the matching text.
\<This matches the start of a word using Scintilla's definitions of words.
\>This matches the end of a word using Scintilla's definition of words.
\xThis allows you to use a character x that would otherwise have a special meaning. For example, \[ would be interpreted as [ and not as the start of a character set.
[...]This indicates a set of characters, for example, [abc] means any of the characters a, b or c. You can also use ranges, for example [a-z] for any lower case character.
[^...]The complement of the characters in the set. For example, [^A-Za-z] means any character except an alphabetic character.
^This matches the start of a line (unless used inside a set, see above).
$This matches the end of a line.
*This matches 0 or more times. For example, Sa*m matches Sm, Sam, Saam, Saaam and so on.
+This matches 1 or more times. For example, Sa+m matches Sam, Saam, Saaam and so on.

Regular expressions will only match ranges within a single line, never matching over multiple lines.