h, j, k, l: move cursori: enter insert modeESC: leave current modeESC + :wq: write and quitESC + :q!: quit (force)# 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)
% # jump to bracket pair
H: move cursor to top of screenM: move cursor to middle of screenL: move cursor to bottom of screenzz: move view pane to middle this linezt: move view pane to top this linezb: move view pane to bottom this lineCTRL+y: move cursor view pane upCTRL+e: move cursor view pane downi: (insert) enter insert mode (before cursor)a: (append) enter insert mode (after cursor)I: insert at the start of the line (before the first word)A: append at the end of the line (after the last word)u: undoCTRL + r: undo undox: delete characterro: replace current letter by odd: delete and copy lineyy: copy (yank) a linep: paste after cursorP: paste before cursorv: select inside line (complete with h or l)V: select lines (complete with j or k)y: copy selectiond: delete selection/SEARCH: then Enter then N (previous) and n (next)# open/create file in new tab
:new filename.ext
# open/create file in new vertical split
:vert new filename.ext
# switch between splits
CTRL-w h
CTRL-w j
CTRL-w k
CTRL-w l
# copy full file
:%y+
# paste
"P+
# 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
# sort a file
1G!Gsort
You should have a clipboard util like xclip installed
"*y: copy on mouse clipboard"*p: paste on mouse clipboard"+y: copy on system clipboard"+p: paste on system clipboard# view the registers
:registers
"""0-9: previously copied things"-"a "b.."z": ". "%"#"="* and "+"_"/q<register><commands>q
# then to play it
@<register>
# then
@@
# to replace
:%s/toto/tata/g
# to wrap lines
:set nowrap
:set wrap
# select the json with shift + V then run
# to prettify
:!jq
# to uglify
:!jq -c
CTRL+w: windows shortcutCTRL+w + n: new window (or :new)CTRL+w + CTRL+v: split window (or :vs)CTRL+w + l: move to right windowCTRL+w + j: move to down windowgcc: Comment line{Visual}gc: Comment or uncomment the selected line(s).