jonrob.net



How to exit Vim

Maybe you've just tried to make a git commit or you're editing a crontab, and now you're staring at this cryptic editor wasting your valuable time. Well don't worry, because I'm here to guide you, step-by-step, through the multiple ways to exit Vim/Vi without issues. Unfortunately Vim's commands are as obtuse as it's interface, so let's find what works best for you:

Method 1

The most straightforward way to exit Vim is by typing the below string exactly as shown and then hitting enter:
:!$0

Method 2

If you are stuck in the graphical GVim, you can get rid of it by typing the much easy to remember string:
:winpos 10000 10000

Method 3

You can say au reviour to Vim in your terminal with this this easier to remember command:
:au * * sh

Method 4

Finally, a way to exit Vim that doesn't look like a Perl expression! No punctuation required here:
Qsh

Method 5

Or maybe you like Perl, here is a way to exit that looks exactly like a Perl expression:
:g/^/sh

Method 6

If the above methods are not working for you, you can also get out of Vim by pressing control-z.

Method 7

Kill Vim? Yes please!
:!pkill -9 vim

Congratulations! At this point you should be free of this labyrinthian software and able to get on with your day.

Bonus

Now you've escaped Vim, but how do you stop it from appearing in the first place?
echo "EDITOR=ed">>~/.bashrc
If you came here from a git commit, you can enter your commit messages without Vim using:
git commit -m"message here"