How to Exit vim ?

Β·

1 min read

Table of contents

No heading

No headings in the article.

Are you unable to exit VIM Terminal? well, I was in the same situation in my starting days, so here are the commands that will help you to exit VIM.

To exit the Vim editor, you can use the following commands:

  1. :q: This command quits Vim. If you have unsaved changes, Vim will refuse to exit and prompt you to save or discard the changes first.

  2. :q!: Use this command to force quit Vim without saving any changes. It discards any modifications you made to the file.

  3. :wq or :x: These commands save the changes and quit Vim. If you have made any modifications, they will be saved to the file before exiting.

  4. ZZ: In normal mode, typing ZZ (capital Z twice) will save the changes and quit Vim.

  5. ZQ: Similar to :q!, this command forcefully quits Vim without saving any changes.

Remember to press the Esc key to ensure you're in command mode before using these commands.

Subscribe to the newsletter for more 😊

Β