- Insert Mode:
i
- Command Mode: by default, or
Esc
in in Insert mode - Visual Mode:
v
-> to select stuff- if the cursor is in a bracket or similar,
%
selects the whole scope
- if the cursor is in a bracket or similar,
- Visual Line:
V
-> same but per lines
- Save:
:w <name>
- Quit:
:q
hjkl
-> left down up rightw
-> word;W
-> whole wordb
-> word back;B
-> whole word back$
-> end of line;^
-> beginning of line (without space);0
-> beginning of linegg
-> beginning of file;G
-> end of file;X + gg
-> go to line X;}
-> next paragraph;{
-> previous Pf{P}
-> jumps to first word that starts with P;F{P}
-> the oppositet{P}
-> jumps just before that character;T{P}
-> the oppositeNumber + command
-> repeat X times a command:{X}
-> go to X line
:edit {X}
-> Open X filex
-> delete char in cursoru
-> undodw
-> delete word;db
-> delete previous worddd
-> delete line;cc
-> delete line and insert modecw
-> delete word and enter insert modect{X}
-> remove from the cursor until X characterci{X}
-> remove inside X (ex: 'asd xx-xx asd' cursor in -,ci'
leaves ''ca{X}
-> remove around X (ex: ['asd-asd'],ca'
leaves [])O
-> insert blank line before;o
-> insert blank line after
d
-> cut;x
-> cut char;X
-> cut prev charp
-> paste after cursor;P
-> paste before cursoryw
-> copy word;yy
-> copy line
/test
-> search "test" word;n
-> search the next;N
-> previous?function
-> search "function" backword;n
-> previous; ->N
-> next:noh
-> unhighlightd/test
-> delete until test wordc/test
-> delete until test word and insert mode
:%s/Text1/Text2/g
-> Changes Text1 with Text2 in the whole file
q{X}
-> start recording macro in X register;q
again ends the recording:registers
-> show registers@{X}
-> starts X macro registered
:!{X}
-> launch command X, for example,:!ls
list files:read !{X}
-> put the output of X in your open file- ex.
:r !curl --silent http://test/file.js
- ex. go to visual line mode, select some coffee code, do colon and ! and write coffee -c -s -p, and it will convert the code selected
- ex.
:ls
-> list buffers oppened:bn
or :bnext -> shows next buffer;:bf
or:bprev
-> shows previous:b#
-> show last opened, so you can jump between two files with:b#
:bf
-> jump to first one:bd{X}
-> removes X buffer, the number watched when executing:ls
:vs
or:vsplit
-> vertical split;:sp
or:split
-> horizontal splitCtrl W {hjkl}
-> Move cursor to left down up right windowCtrl W {HJKL}
-> Place window to that positionCtrl W {+-}
-> Resizes window height, with Ctrl W 10 +, increases 10pxCtrl W {<>}
-> Resized window widthCtrl W
= -> Resize window equally:sb{X}
-> Split with buffer X:vert sb{X}
-> Split vertically with buffer X:tabedit {X}
-> Open {X} file in a tabgt
-> go to next tab;gT
-> go to previous tab
>>
-> indent<<
-> indent back>{X}
-> indent X times- you can also go to visual mode, select some lines, do
>>
, and indent all - or go to visual mode, select some bad indented text, and hit
=
- you can also go to visual mode, select some lines, do
gg=G
-> indent everything- in insert mode:
Ctrl+t
indents;Ctrl+d
indents back zf{X}{Y}
-> folds X times in Y direction. ex.zf5j
zo
-> open fold;zc
-> close fold;zd
-> delete fold;zO
-> open all- in a ({
zf%
-> fold to closing }) zi
-> fold/unfold every fold
Ctrl+X, Ctrl+O
shows the omnicomplete menuCtrl+X, Ctrl+P
complete the keywordCtrl+X, Ctrl+L
complete the line