A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://stackoverflow.com/questions/11828270/how-to-exit-the-vim-editor below:

vi - How do I exit Vim?

Pictures are worth a thousand Unix commands and options:

I draw this to my students each semester and they seem to grasp vi afterwards.

Vi is a finite state machine with three main states.

It starts in COMMAND mode, where you perform editor functions using very short keystroke sequences, blindly. You know what you are doing; this isn't for amateurs.

When you want to actually edit text, you should go to INSERT mode with some keystroke; common ones include:

Now, answering the question: exiting.

You can exit vi from EX mode:

w and x accept a file name parameter. If vi already knows the filename to use (e.g. it was started with vi file), you need not give it here again.

At last, the most important: how can you reach EX mode?

EX mode is for long commands that you can see typing at the bottom line of the screen. From COMMAND mode, you press colon, :, and a colon will appear at the bottom line, where you can type the above commands.

From INSERT mode, you need to push ESC, i.e. the Escape button, going to COMMAND mode, and then: to go to EX mode.

If you are unsure, push ESC and that will bring you to command mode.

The robust method is ESC-:-x-Enter which saves your file and quits.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4