How To Exit From Vim?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-exit-from-vim/
PINTEREST
PINTEREST
INSTAGRAM

Vim have different and alternative solutions for different requirements. In this tutorial we will look different ways to quit or exit and save and exit. In this tutorial we will use quit and exit for the same thing.

Exit or Quit

The most used and simple usage is just exiting or exiting from the current vim session. If there is changes after opening file this command will not work because this command do not specifies action against changes. We will quit by using :q command.

Exit Without Saving

We have alternative usage for exiting. As stated previous step we can not quit from vim if file has unsaved changes. We have :q! command which will quit without saving changes.

Write or Save and Quit

We use write and save statements for the same action. We can not exit vim sessions without saving changes. We can use :wq command where w will save and q will quit. The sequence is important because they run accordingly.

OR we can use exit command which will first save the changes and then exit.

Write and Quit Even Not Saved

Some times files we have opened and changed may be read only. We can try to save but we will not succeeded. So we can provide :wq! command which used try to save and quit even if file is not saved.

Quit All

Vim can open multiple file at the same time. One way to close these files is one by one. Another way is closing all files with the qa .

LEARN MORE  Vim, Vi End of File and Line

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-exit-from-vim/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)