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
| Keys | What they do |
|---|---|
:w | Save (write) the file |
:wq or :x | Save, then quit |
:w name.txt | Save a copy under a new name |
:wa | Save 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