DEV Community

Cover image for Vim quickies/ cheatsheet

Vim quickies/ cheatsheet

Rubin on September 30, 2019

Vim Cheatsheet Contents Generally helpful stuff Navigating around text Working with multiple files Searching Manipulating...
Collapse
 
moopet profile image
Ben Sinclair •

"Delete the word under cursor" should be diw, de only works for the same purpose if you're already at the start of the word.

"Replace mode (overtype)" should be R, r will only let you change a single character.

Collapse
 
jasper_zanjani profile image
Jasper Zanjani •

Your comment made me go back to Oualline's Vim Book to research this. I totally did not know about the i and a motion commands! Great tip!

Collapse
 
rubiin profile image
Rubin •

cool

Collapse
 
vlasales profile image
Vlastimil Pospichal •

de is good for delete word from cursor to end. It is good for different purpose.

Collapse
 
zchtodd profile image
zchtodd •

I've been working with Vim for quite a while, but there's always something new to learn. Still to this day I'll hit a sequence of keys by mistake and something will happen that I've never seen before.

Collapse
 
rubiin profile image
Rubin •

thats the beauty of vim

Collapse
 
gnsp profile image
Ganesh Prasad •

There is a catch with visual block mode. If you're running vim in a terminal that maps Ctrl+v to paste action, then Ctrl+v won't work for visual block mode in vim. However, vim also maps Ctrl+q to visual block mode in defaults. IMO, it's safer to memorize Ctrl+q as the key combination for visual block mode.

Collapse
 
rubiin profile image
Rubin •

Cool. Haven't tried that one yet

Collapse
 
moopet profile image
Ben Sinclair •

Unless your OS maps C-q to "quit application" :)

Collapse
 
chsanch profile image
Christian Sánchez •

To understand more about movements/navigation in vim I would recommend to read the section 03 in the Vim user manual, just execute:

:h usr_03
Collapse
 
rubiin profile image
Rubin •

I have also added a link to an interactive site

Collapse
 
oinak profile image
Oinak •

Very good article!

Thanks for sharing

in Searching section, where you say:

Find and replace globally :%s/<find>/<replace>//gc

I think you may mean

Find and replace globally :%s/<find>/<replace>/gc

and maybe could comment that the final 'c' is for asking for confirmation on each replacement.

Thanks for your work and time.

Collapse
 
mahendrachoudhary profile image
Mahendra Choudhary •

I use vim very often and always hard time to remember all the commands , thanks for this cheat sheet brother

Collapse
 
rubiin profile image
Rubin •

Anytime bro. It takes heck lot of time to get used to Vi , I myself find forgetting many commands , and whenever I do i visit this cheetsheet

Collapse
 
jasper_zanjani profile image
Jasper Zanjani •

delete to end of line is also D

Collapse
 
prabangkoro profile image
bagus prabangkoro •

I've been using vim for few weeks, and it'getting natural and saves my time a lot! I like its clear rule, text object (sentence, paragraph, word, tag), or action (delete, copy, change).

Collapse
 
rubiin profile image
Rubin •

Yeah. If you are doing things on console, you can see it's power

Collapse
 
rubiin profile image
Rubin •

BTW you can check openvim.com if you are starting out

Collapse
 
get_right_a1 profile image
/ •

To toggle the case=> `
This would be pretty useful to correct the typos.

To repeat the previous command=> .

Collapse
 
daviddalbusco profile image
David Dal Busco •

I think I basically use only i a x / n dd : wq since years 😁

Thx for new tips 👍

Collapse
 
rubiin profile image
Rubin •

Anytime

Collapse
 
jasper_zanjani profile image
Jasper Zanjani •

Damn, it's a helluva confidence boost when you look at a cheatsheet and know EVERY SINGLE item

Collapse
 
tonypelliccio profile image
Tony Pellicccio •

Left out one command I love, cw - or change word. Saves a lot of time.

Collapse
 
salvadorrueda profile image
salvadorrueda •

'u' for undo the last change and
'.' for repeat the last command are two commands I use most frequently despite :wq (write and quit)

Collapse
 
rubiin profile image
Rubin •

I have added a link to an interactive vim tutorial at the end of the post so anyone starting out with vim can try it out online

Collapse
 
gdahboy profile image
gdahboy •

i like very much vim , but i like more IDE . Jetbrains product and Xcode and i am feedup using FakeVim . so can i integrate Vim in these IDE

Collapse
 
rubiin profile image
Rubin •

Yes. You can try the vim bindings plugins

Collapse
 
2357gi profile image
Kento Ohgi •

ctrl-[ is better then ctrl-c cuz that dose not trigger the |InsertLeave| autocommand event.