4.9 KiB
4.9 KiB
Neovim's default shortcuts.
Some actions like yy
or dd
in normal mode can be used with navigation commands. If dd
deletes the whole line under cursor, df)
will delete everything from cursor to (including) character )
.
Letters.
Mode | Key | Action |
---|---|---|
Input, Visual | <Esc> |
Enter command (normal) mode. |
Normal, Visual | q |
Start/stop recording macro. |
Normal, Visual | Q |
Play latest recorded macro. |
Normal, Visual | w |
Go to the start of the next word. |
Normal, Visual | e |
Go to the end of the current word. |
Normal, Visual | W |
Go to the start of the next word (ignore special characters). |
Normal, Visual | E |
Go to the end of the current word (ignore special characters). |
Normal, Visual | r |
Replace selected characters. |
Normal | R |
Enter replace mode (exit with <Esc> ). |
Normal | t |
Navigate till (1 char before) specified char. |
Normal | T |
Navigate back till (1 char before) specified char. |
Normal | f |
Navigate to the specified char. |
Normal | F |
Navigate back to the specified char. |
Visual | y |
Copy (yank) selection. |
Normal | yy |
Copy selected line. |
Normal | Y |
Copy from cursor to the end of line. |
Normal | u |
Undo. |
Normal | U |
Undo line. |
Visual | u |
Make selection lowercase. |
Visual | U |
Make selection uppercase. |
Normal | i |
Insert mode (before cursor). |
Normal | I |
Insert mode at the line start. |
Normal | o |
Insert at the next line. |
Normal | O |
Insert at the line before. |
Normal | p |
Insert after the cursor. |
Normal | P |
Insert before the cursor. |
Normal | a |
Insert mode (after cursor). |
Normal | A |
Insert mode the line end. |
Normal | s |
Substitute (replace) the character under cursor. |
Normal | S |
Substitute (replace) the line under cursor. |
Visual | d |
Delete selection. |
Normal | dd |
Delete selected line. |
Normal | D |
Delete from cursor to the end of line. |
Normal | gg |
Go to the start of the file. |
Normal | gf |
Go to the file under cursor. |
Normal | G |
Go to the end of the file. |
Normal, Visual | h |
Go left. |
Normal, Visual | H |
Go to the screen top. |
Normal, Visual | j |
Go down. |
Normal, Visual | J |
Join lines. |
Normal, Visual | k |
Go up. |
Normal, Visual | K |
Help. |
Normal, Visual | l |
Go right. |
Normal, Visual | L |
Go to the screen bottom. |
Normal | zt |
Scroll cursor to the top. |
Normal | zb |
Scroll cursor to the bottom. |
Normal | zz |
Scroll cursor to the center. |
Normal | ZZ |
Save and quit. |
Normal | ZQ |
Quit without saving. |
Normal, Visual | x |
Same as Delete key. |
Normal, Visual | X |
Same as Backspace key. |
Normal, Visual | c |
"Change". Same as d or s with navigation, but you enter insert mode after that. |
Normal | v |
Visual selection (cursor). |
Normal | V |
Visual selection (lines). |
Normal | <C-v> |
Visual selection (block). |
Normal, Visual | b |
Go to previous word. |
Normal, Visual | B |
Go to previous word (ignore special characters). |
Normal | n |
Go to the next find (same as F3 in other editors). |
Normal | N |
Go to the previous find. |
Normal | m |
Set mark. |
Normal | M |
Screen middle. |
Normal | <C-a> |
Increment number under cursor. |
Normal | <C-x> |
Decrement number under cursor. |
Symbols.
Mode | Key | Action |
---|---|---|
Normal | : |
Enter command mode. |
Normal, Visual | @ |
Play macro. |
Normal | ! |
External filter. TODO: check. |
Normal, Visual | & |
Repeat command. |
Normal, Visual | << |
Indent left the selected lines. |
Normal, Visual | >> |
Indent right the selected lines. |
Normal, Visual | = |
Auto format. |
Normal | . |
Repeat input on selected line. |
Normal | ( , ) |
Begin/end sentence. TODO: check. |
Normal | { , } |
Begin/end parameter. TODO: check. |
Normal | / |
Find. |
Normal | ? |
Reverse find. |
Normal, Visual | , |
Reverse t/T/f/F. |
Normal, Visual | ; |
Repeat t/T/f/F. |
Normal, Visual | ' |
Go to the mark's start of the line. TODO: check. |
Normal, Visual | ` |
Go to the mark. TODO: check. |
Normal, Visual | $ |
Go to the end of the line. |
Normal, Visual | % |
Go to match (i.e. start or end of the brackets). |
Normal, Visual | - |
Previous line. |
Normal, Visual | + |
Next line. |
Normal, Visual | _ |
Beginning of the line down. TODO: check. |
Normal, Visual | ` | ` |
Normal, Visual | # |
Previous indent. TODO: check. |
Normal, Visual | * |
Next indent. TODO: check. |
Normal, Visual | ^ |
Go to the start of the line (non-whitespace). |
Normal, Visual | 0 |
Go to the start of the line. |
Visual | ~ |
Toggle case: AaA → aAa . |
Commands.
Commands can be chained, i.e. you can use :w
and :q
together like :wq
.
Command | Action |
---|---|
w |
Save file (write). |
q |
Quit. |
a |
Apply action to all buffers (files). |
! |
Force action (like quit w/o saving). |
e |
Open file by path (full or relative). |
%s/from/to/g |
Replace from to to . g at the end applies it to all matches within the lines, not just the first one. % applies it to the whole file, without it will only apply to the selected line. You can also use something like .,$s/ ... to apply from current line to the end of the file, or 1,5s/ ... to apply for lines from 1 to 5 (or just use visual selection). |
h leader |
Show help for leader . |
new |
New file. |