Code Editor / Code Editor Reference |
A listing of vi commands currently implemented in Code Editor.
Keystrokes | Description |
---|---|
h l k j | character left, right; line up, down |
b w | word/token left, right |
ge e | end of word/token left, right |
0 ^ $ | beginning, first, last character of line |
nG/:n ngg | line n, default the last, first |
B W | space-separated word left, right |
gE E | end of space-separated word left, right |
H M L | Top, middle, bottom of screen |
g0 gm | beginning, middle of screen line |
g^ g$ | first, last character of screen line |
fc Fc | next, previous occurrence of character c |
tc Tc | before next, previous occurrence of c |
Keystrokes | Description |
---|---|
i a | insert before, after cursor |
I A | insert at beginning of first character, end of line |
gI (g + Capital I) | insert text in first column/go to first column |
o O | open a new line below, above the current line |
rc | replace character under cursor with c |
R | replace characters starting at the cursor |
cm | change text of movement command m |
cc or S | change current line |
C | change to the end of line |
Keystrokes | Description |
---|---|
x X | delete character under (right), before (left) cursor |
dm | delete text of movement command m |
dd D | delete current line, to the end of line |
J gJ | join current line with next, without space |
:rd | delete range r lines |
Keystrokes | Description |
---|---|
/s← ?s← | search forward, backward for s |
n or /← | repeat forward last search |
N or ?← | repeat backward last search |
# * | search backward, forward for complete word under cursor |
g# g* | same, but also find partial matches |
gd gD | local, global definition of symbol under cursor |
:rs/f /t/x | substitute f by t in range r; x: g -- all occurrences, c -- confirm changes |
Keystrokes | Description |
---|---|
ym | yank the text of movement command m |
yy/:y or Y | yank current line into register |
:ry | yank r range of lines |
p P | put register after, before cursor position |
Keystrokes | Description |
---|---|
u U | undo last command, restore last changed line |
. | repeat last changes |
.n | repeat last changes with count replaced by n |
Keystrokes | Description |
---|---|
~ | switch case and advance cursor |
g~m gum gUm | switch case, lc, uc on movement m |
Keystrokes | Description |
---|---|
esc or ^] | abandon editing → command mode |
Keystrokes | Description |
---|---|
mc | mark current position with mark c ∈ [a Z] |
'c 'C | go to mark c in current, C in any file |
Keystrokes | Description |
---|---|
:e f | edit file f, reload current file if no f |
:rw f | write range r to file f (current file if no f ) (:w, :w f) |
:q :q! | quit and confirm, quit and discard changes |
:wq or :x or ZZ | write to current file and exit |
:r f | insert content of file f below cursor |
:n | next file |
:p | previous file |
:n,kw >> file1 | append lines n-k into another file file1. |
Keystrokes | Description |
---|---|
, ; | separates two line numbers, set to first line |
:n,m | lines n to m |
n | an absolute line number n |
. $ | the current line, the last line in file |
% * | entire file, visual area (exclude) |
't | position of mark t |
/p/ ?p? | the next, previous line where p matches |
+n -n | +n, −n to the preceding line number |
Keystrokes | Description |
---|---|
zo zc zO zC | open, close one fold; recursively |
[z ]z | move to start, end of current open fold |
zj zk | move down/up to start/end of next/previous fold |
zm zM | fold more, close all folds |
zr zR | fold less, open all folds |