Most of commands accept number before (eg: 3k
moves down 3 times)
modes
i
- insert modev
- visual, used for text selection
:open X
- Open file:ter[minal]
- Open terminalctrl+w v
- Split screen horizontallyctrl+w s
- Split verticallyctrl+w l/h/j/k
- Switch to right/left/up/down sidectrl+w L/H/J/K
- Switch to panel to right/left/up/downctrl+w </>
- Resize panel widthctrl+w +/-
- Resize panel height
visual mode commands
v
- Go to visual modey
- Copy textd
- delete selectionx
- cut selectionp
,P
- paste selection before/after custor (ori
in Command mode)dw
- delete wordV
- select linecw
- change wordC
- change whole lineD
- Delete rest of line from cursor
navigate
j
,k
- ⬆️ ⬇️h
,l
- ⬅️ ➡️0
,$
- Go to Start/End of the linew
,W
(ore
,E
,B
) - Move by wordb
- Back to wordgg
- Go to endG
- Go to end
commands
u
- ↩️ Undo.
- 🔁 Repeat last commandNdd
- ❌ DeleteN
linesx
- ❌ Delete charo
- ↵ Add a new lineA
- Insert at the line end
search and replace
/text
- 🔍 search fortext
?text
- Search topn
,N
- Go to next/previous search result:%s/str/rep
- Replacestr
withrep
10G
- Go to line10
bookmarks
mx
- Create a mark with namex
(mark this position)'x
- Jump to markx
view & layout
:split FILE_NAME
- Split vertically and open file
macros
q1
- Start macros with number1
(basically record and replay commands)q
- Stop macro record@1
- Call macros1
(or10@1
to run 10 times)
a few ways to get out of Vim
ZZ
,:q!
,:!kill -9 $PPID