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)
# you can combine
df" # delete to " and "
dt" #delete to "
d% # delete to the pair bracket/parenthesis
. # repead the delete
; # repeat the find
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 + a: increment number on the lineCTRL + x: decrement number on the lineCTRL + r: undo undoCTRL + R: insert registerCTRL + R + =: evaluate and insert (easing calculation)C - delete to the end of lineci[ - or ci" ci( # change between the charciw - inner worddaw - word and spaceJ - collapse next line with spacegJ - collapse next line without spacegU - majgUiw - maj current wordg~ - inverse on the deplacementg~$ - inverse until end of linedap - delete paragraph and linedip - delete paragraphgq - reformatgqip - reformat inner paragraph/<word> - search then enter then n and N?<word> - search before then enter// - redo the search* - search the current word% - jump to bracket pairma - place a marker'a - go to markerx: 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)CTRL + v: start visual blocgh - character-wise select modegH - line-wise select modegCtrl-h - block-wise select modey: copy selectiond: delete selection# switch between splits
CTRL-w h
CTRL-w j
CTRL-w k
CTRL-w l
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:registers or :reg - view the registers"""0-9: previously copied things"-"a "b.."z": ". "%"#"="* and "+"_"/q<register><commands>q - record a macro@<register> - then to play it@@ - replay the replayed macro:s/toto/tata - replace current line:%s/toto/tata/g - replace in file:%s/toto/tata/gc - ask yes no before replacing:g/WORD/d - delete all lines with WORD:v/WORD/d - delete all lines without WORD:g/word/normal <keys> - execute on line with word1G!Gsort - sort a file:sort - sort file:sort u - sort unique:set tw=20 - set width:set nowrap - to disable wrap lines:set wrap - to enable wrap lines:new filename.ext - open/create file in new tab:vert new filename.ext - open/create file in new vertical split:%y+ - # copy full file:bd - close the buffer:close - close the window# 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
Select the json with shift + V then run
:!jq - to prettify:!jq -c - to uglifyCTRL+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).