golb

Vim && Neovim

Survival

Moving cursor

# move cursor
h j k l

# move relative
8j
# will move 8 line down

G # go to last line
gg # go to first line
5G # go to line 5

w  # move to beginning of next word
b  # move to previous beginning of word
e  # move to end of word
W  # move to beginning of next word after a whitespace
B  # move to beginning of previous word before a whitespace
E  # move to end of word before a whitespace

0  # move to beginning of line
$  # move to end of line
_  # move to first non-blank character of the line
g_ # move to last non-blank character of the line
f<char> # to next <char> cursor is on <char> (same line)
F<char> # to previous <char> cursor is on <char> (same line)
t<char> # to next <char> cursor is before (same line)
F<char> # to previous <char> cursor is after (same line)

# you can combine
df" # delete to " and "
dt" #delete to "
d% # delete to the pair bracket/parenthesis

. # repead the delete
; # repeat the find

Moving cursor

Normal mode and insert mode

Edition

Shortcuts Normal mode

Selection

Windows

# switch between splits
CTRL-w h
CTRL-w j
CTRL-w k
CTRL-w l

System clipboard

You should have a clipboard util like xclip installed

Registers

Macros

Commands

# read and insert a file
:r file.txt

# launch shell commands
:!echo 1

# launch shell commands and capture output in the file
:r! echo 1
# will insert 1

Format json

Select the json with shift + V then run

Windows

Comment