Vim Scoops / Lessons / Save a file

How to save a file in Vim

Press Esc, type :w and press Enter. To save and close in one go, use :wq.

The keys

KeysWhat they do
:wSave (write) the file
:wq or :xSave, then quit
:w name.txtSave a copy under a new name
:waSave every open file

Vim calls saving writing, which is where the w comes from. When it's done, the bottom line confirms it with the file name, line count and size.

Until you write, your changes only live in Vim's buffer. Many status lines show [+] while there's something unsaved.

Related

Want all of Vim, in order? Vim Scoops is a free game that starts at h j k l and builds up to macros.

Play the full game