DELAPARRA
Index
Color
NL
Category: Keyboard shortcuts

:wq (write & quit)

Explained by Updated

What is :wq (write & quit)?

:wq (write & quit): Vim: save the file and close the editor. The legendary "how do I exit Vim" answer. :wq is the Vim command to write the file and quit. You press Escape to make sure you are in normal mode, type :wq, and press Enter. :q! quits without saving, and :x saves only when something changed.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about :wq (write & quit)

How is :wq (write & quit) used in practice?

Most developers meet Vim by accident. Git opens it for a commit message or during a rebase, and suddenly the keyboard does not behave as expected. Knowing these three commands gets you out safely.

What should you keep in mind with :wq (write & quit)?

If you would rather use another editor, tell Git so. git config --global core.editor "code --wait" makes Git open VS Code and wait until you close the tab. Setting the EDITOR variable in your shell does the same for most other tools. That said, basic Vim is worth an hour of practice, because it is installed on nearly every server you will ever log into.

At a glance

CategoryKeyboard shortcuts
Explained by
Updated

More Keyboard shortcuts terms

All terms starting with a number or symbol

Skills

Manuals

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.