← Blogs
Vim - Cheatsheet
Vim is a very powerful text editor and can be configured to use as IDE.
Learning vim has a steep learning curve. Try replacing your regular IDE with vim or work with it side by side. Slowly you can figure out how to do basic actions you do in IDE with vim such as copy, paste, select, tab, split and more.
Create your own cheat sheet & that would be the go-to place to reference it later.
I've shared mine below with the vim configuration link.
:q | Quit | :q! | Force quit |
:w | Save | :wq | Save & Quit |
h | Move arrow left | j | Move arrow down |
k | Move arrow up | l | Move arrow right |
Ctrl + r | Redo changes | u | Undo changes |
v | Enter visual mode | V | Enter visual line mode |
Ctrl + v | Enter visual block mode | d | Delete |
c | Yank | p | Paste |
i | Insert | I | Prepend |
o | Next line | O | Previous line |
a | Append | A | Append from end of line |
dd | Delete the whole line | yy | Copy full line |
yiw | Copy current word | cc | Delete the line & change |
r | Replace the word | w | Jump words forward |
b | Jump words backword | dw | Delete a word |
d5w | Delete 5 words | 5d5w | 5 times delete 5 words |
0 | Start of line | $ | End of line |
d0 | Delete words before the cursor | d$ | Delete words after the cursor |
ciw | Delete word & Insert mode | cip | Change inner paragraph |
dip | Delete inner paragraph | yip | Yank inner paragraph |
vip | Select paragraph | % | Nearest/matching {[()]} |
gg | Jump to start of file | G | Jump to end of file |
:n | Go to line n | nG | Go to line n |
gg=G | To indent all | ggVG= | To indent all in Visual mode |
== | To indent current line | /<word> | Search word & Press n to find the next occurrence or N to find the previous occurrence. |
ma | Mark the position as a | dma | To delete mark a |
'a | Jump to mark a | '] | Cycle through mark |
'[ | Cycle through mark in reverse | :marks | List all marks |
zf | Fold selected line | zd | Delete fold |
za | Toggle fold | zo | Open fold |
zc | Close fold | zf1j | Fold one line below |
zM | Close all fold | zR | Reveal all fold |