How to combine :w and :q?

In Vim, you can combine the :w (write) and :q (quit) commands into a single command by using :wq. This command saves any changes to the file and then exits Vim.

Here's how to use it:

  1. Press Esc to ensure you are in normal mode.
  2. Type :wq and press Enter.

This will save your changes and close the editor. If you want to force quit without saving changes, you can use :q!.

0 Comments

no data
Be the first to share your comment!