i → Insert mode. Type ESC to return to Normal mode.
x → Delete the char under the cursor
:wq → Save and Quit (:w save, :q quit)
dd → Delete (and copy) the current line
p → Paste
hjkl→ basic cursor move (←↓↑→).
:help <command> → Show help about <command>.
a → insert after the cursor
o → insert a new line after the current one
O → insert a new line before the current one
cw → replace from the cursor to the end of the word
0 → go to the first column
^ → go to the first non-blank character of the line
$ → go to the end of line
g_ → go to the last non-blank character of line
/pattern → search for pattern
P → paste before, remember p is paste after current position.
yy → copy the current line, easier but equivalent to ddP
u → undo
<C-r> → redo
:e <path/to/file> → open
:w → save
:saveas <path/to/file> → save to <path/to/file>
:x, ZZ or :wq → save and quit (:x only save if necessary)
:q! → quit without saving, also: :qa! to quit even if there are modified hidden buffers.
:bn (resp. :bp) → show next (resp. previous) file (buffer)
. → (dot) will repeat the last command
N<command> → will repeat the command N times
NG → Go to line N
gg → shortcut for 1G - go to the start of the file
G → Go to last line
w → go to the start of the following word
e → go to the end of this word
% → Go to the corresponding (, {, [.
* (resp. #) → go to next (resp. previous) occurrence of the word under the cursor
<start position><command><end position>
eg. 0g$
<verb><modifiers><noun>
verb: d,c,y,v
modifier: i,a,t,f,2,/
noun:w,s,p,block,"lol"
0 → go to column 0
^ → go to first character on the line
$ → go to the last column
g_ → go to the last character on the line
fa → go to next occurrence of the letter a on the line. , (resp. ;) will find the next (resp. previous) occurrence.
t, → go to just before the character ,.
3fa → find the 3rd occurrence of a on this line.
F and T → like f and t but backward.
<action>a<object>
<action>i<object>
actions: v,d,c
objects: w,W,s,p or characters
C-v : Visual mode block selection
0<C-v><C-d>I-- [ESC]
C-v : Visual mode block selection
0<C-v><C-d>I-- [ESC]
Registers: a,b
qa
@a
J → join all the lines together.
< (resp. >) → indent to the left (resp. to the right).
= → auto indent
:split → create a split (:vsplit create a vertical split)
<C-w><dir> : where dir is any of hjkl or ←↓↑→ to change the split.
<C-w>_ (resp. <C-w>|) : maximise the size of the split (resp. vertical split)
<C-w>+ (resp. <C-w>-) : Grow (resp. shrink) split