Vim Commands 101 ππ»
A comprehensive cheat sheet to essential Vim commands for efficient text editing.
Inside a block keys -
Action | Command |
yank inside " " / () / {} / [] | yi" / () / {} / [] |
delete inside " " / () / {} / [] | di" / () / {} / [] |
edit inside " " / () / {} / [] | ci" / () / {} / [] |
Whole line operations-
Actions | Command |
dd | delete the whole line |
cc | change the whole line |
yy | copies the whole line |
V | select the whole line |
D | delete the line from cursor to the end |
C | changes the line from cursor to the end |
Y | copies the whole line |
d0 | delete the line form cursor to the start |
c0 | change the line form cursor to start |
v0 | select the lilne from cursor to the start |
y0 | yank the line form cursor to the start |
Motions -
Action | Commnad |
h / j / k / l | move left/down/up/right |
W/w | move one word forward |
B/b | move one word backward |
gg | move to the top of the file |
G | move to the end of the file |
zz | move the window to the middle |
o | move to the next line with edit mode |
shift + h | move to the tab on the left |
shift + l | move to the tab on the right |
shift + [ | move down in file (fast) |
shift + ] | move down in file (fast) |
Word commands -
Action | Commands |
dw | delete the word you are on |
yw | yank the word you are on |
cw | change the word you are on |
ciw | change in word |
diw | delete in word |
yiw | yank in word |
viw | select in word |
db | delete previous word |
cb | change previous word |
yb | yank previous word |
vb | delete previous word |
Searching Commnads -
Actions | Commnads |
searching | type '/' in normal mode, search for keyword, press enter, move between words with 'n' and 'N' |
searching | |
& | |
replacing | :%s/foo/bar/g Find each occurrence of 'foo' (in all lines), and replace it with 'bar' |
To find all occurrences of 'foo' in the current line, add the g flag. :s/foo/Vim/g |
Misc Commnads -
Action | Command |
gcc | Comment line |
\== | fix indentation |
Thanks for reading β¨ I hope you found these insights valuable. If you learned something new today, don't forget to share this knowledge with others who might benefit from it.
Letβs connect on, Twitter , Linkedin Find all the other important links at, Linktree π
Until next time! Goodbye ππ»
Β