Vim Commands 101 πŸ––πŸ»

A comprehensive cheat sheet to essential Vim commands for efficient text editing.

Vim Commands 101 πŸ––πŸ»

Inside a block keys -

ActionCommand
yank inside " " / () / {} / []yi" / () / {} / []
delete inside " " / () / {} / []di" / () / {} / []
edit inside " " / () / {} / []ci" / () / {} / []

Whole line operations-

ActionsCommand
dddelete the whole line
ccchange the whole line
yycopies the whole line
Vselect the whole line
Ddelete the line from cursor to the end
Cchanges the line from cursor to the end
Ycopies the whole line
d0delete the line form cursor to the start
c0change the line form cursor to start
v0select the lilne from cursor to the start
y0yank the line form cursor to the start

Motions -

ActionCommnad
h / j / k / lmove left/down/up/right
W/wmove one word forward
B/bmove one word backward
ggmove to the top of the file
Gmove to the end of the file
zzmove the window to the middle
omove to the next line with edit mode
shift + hmove to the tab on the left
shift + lmove to the tab on the right
shift + [move down in file (fast)
shift + ]move down in file (fast)

Word commands -

ActionCommands
dwdelete the word you are on
ywyank the word you are on
cwchange the word you are on
ciwchange in word
diwdelete in word
yiwyank in word
viwselect in word
dbdelete previous word
cbchange previous word
ybyank previous word
vbdelete previous word

Searching Commnads -

ActionsCommnads
searchingtype '/' 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 -

ActionCommand
gccComment 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 πŸ‘‹πŸ»

Β