DEV Community

Cover image for Emergency Vim Commands

Emergency Vim Commands

G.L Solaria on October 12, 2019

Now I love vim but I have seen fear in the eyes of people who somehow find themselves faced with vim for the first time. If you haven't experienced...
Collapse
 
kostassar profile image
Kostas Sar

I think this post will save many people trapped in vim!

Personally plain ":wq" has never bothered me except in case I was in a file I should not have edited in the first place (Or without the correct rights).

What issues does '!' solve?

Collapse
 
glsolaria profile image
G.L Solaria

It just forces the command without asking any more questions. I figured emergency responders don't want to be asked "are you sure?" after they have already issued a command :)

Collapse
 
peteruren profile image
Pete

A great tongue-in-cheek but informative article, not only painting 'Dont Panic' on Vim but reminding those of us (and by that I mean me) working in VT100 terminals 30+ years ago and encountering these common issues on any terminal input.

Collapse
 
roramigator profile image
Morado

I no longer have to be afraid...

Collapse
 
glsolaria profile image
G.L Solaria

I do know about ZZ. I thought that maybe I could say when it is time to go to sleep and seal in the memories but it didn't fit with my theme. I also thought that making it to similar to :q! would be easier for people to remember if they don't use vim regularly. Can you tell I think too much sometimes? But you are right - ZZ is the way to go when time is of the essence!

Collapse
 
maxdevjs profile image
maxdevjs • Edited

Good article, nice tips. I also learned a new word, "bothing". And I use ":q" to exit from my terminal now

Collapse
 
glsolaria profile image
G.L Solaria

You showed me a new word today! I didn't realise I was being so obscure. Good pick up.

Collapse
 
daviddalbusco profile image
David Dal Busco

I use "Esc : q ! enter" way too often, not ashamed 😄

Cool article, thx you 👍

Collapse
 
voyeg3r profile image
Sérgio Araújo

Sometimes we ask ourselves, after messing up with a file for a while, how in the hell can I discard all changes I made in this file? The answer to this:

:e!

Now our file got back to its old stat