Author : Piyush Gupta
VIM is an enhanced version of VI text editor. It is highly configurable text editor to edit files very efficiently. Many of Linux beginners faces issue with exit form vi/vim editor. This tutorial will help you to exit Vim text editor in Linux command line.
How to Exit Vim?
As we have already seen in advanced Vim tips, there are multiple ways to quit Vim. Let me list them one by one along with the procedure.
You have several ways to exit from Vim text editor. But you need to choose the right command to exit from Vim editor based on your decision. Remember that exit command always run from Vim command mode. So you need to press
ESC
to go to command mode. Now type a colon :
to before writing exit command.- ESC + :q – Simple exit from a file, only if no changes made to file.
- ESC + :wq – Write changes and quite from Vim editor.
- ESC + :q! – Quit Vim editor without saving any changes (discard all changes made after edit file or last saved).
Using Keyboard Shortcuts
You can also use keyboard shortcuts to exit from vim editor. No need to type any thing. Press
ESC
to make sure you are in command mode.- Shift + z + z – save changes and exit
- Shift + z + q – exit without saving changes
Reference: http://vimdoc.sourceforge.net/
No comments:
Post a Comment