Zum Inhalt

neovim cheatsheet


Keys Explanation
esc normal mode
i insert mode
:q quit
:w write
:wq write & quit
:q! quit override
a append text
I insert (before line)
A append (after line)
o new line below
O new line above
Keys Explanation
HJKL jumps left/down/up/right one char/lines at a time
w next word
b previous word
W next word (ignore special characters)
B previous word (ignore special characters)
8w jump eight words
% jump to brackets/parentheses
gg navigate to the beginning of the file
G navigate to the end of the file
17G Go to line 17
:19 Go to line 19
0 beginning of line - navigate to the beginning of the line
$ end of line - navigate to the end of the line


Keys Explanation
r replace letter - replace a character (without going insert mode)
R replace mode - replace the whole word (without going insert mode)
cw change word
c7w change seven words
4j/<downArrowKey> move four lines down
C replace rest of line
dw delete word
D delete rest of line
d4w delete 4 words
dd delete line - deletes the whole line wherever your cursor is
cc change line - change the whole line wherever your cursor is
4dd delete 4 lines
8cc change 8 lines
x deletes a character (without going insert mode)
u undo
Ctrl+u undo inside insert mode
*Ctrl+r redo
5u undo last five changes
7ctrl+r redo seven last things
ciw change inner word
diw delete inner word
J deletes an empty line (without going insert mode)
P inserts an empty line (without going insert mode)
ci)/]/} change inner parentheses/brackets
c% change until bracket - change inner content including the closing bracket

Visual Mode

Keys Explanation
v visual mode
d delete
c change
y yanking(copy)
Y yank immediately without going to visual mode
p paste after
P paste before
yy yank line
5yy yank five lines
9p paste nine times
y5w yank five words
yi) yank inner brackets
yiw yank inner words
50<downArrowKey> select 50 lines below
V visual line
ctrl+v visual block
dot(.) repeat last operation
zz center selected line
> shift right
< shift left
>>&<< shift Line
= indent
== indent line
gg=G indent whole file
ggdG delete whole file

Vim commands

Keys Explanation
/word search for word
n next occurence
N previous occurence
+ next token occurrence
# previous token occurrence
*:s/old/new/g replace
:%s/old/new/g replace everywhere
:set number/nu line numbers
:set relativenumber/rnu rel. numbers
*:colorscheme <theme> select theme
:set tabstop=4 tab width to 4
:set autoindent auto indentation
:set mouse=a activate mouse
:set mouse='' deactivate mouse

Custom Indentation

Keys Explanation
:set shiftwidth=4 self explanatory
:set tabend=4 self explanatory
4h/j/k/l Jumps left/down/up/right 4 characters/lines
c4h/j/k.l Replaces 4 chars/lines from left/down/up/right (You can repalce 'c' with 'd' to delete without going insert mode)


Letztes Update: March 25, 2023
Erstellt: February 24, 2023