Like every ex command, :w only works from normal mode — Esc first if you've been typing.
| Keys | What it does |
|---|---|
| :w | save |
| :wq | save and quit |
| :w newname.txt | save a copy under a new name |
| :w !sudo tee % | the classic: save a root-owned file you opened without sudo |
| :wa | save all open buffers |
Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “The missing period” mission takes about a minute.
Practice free — no signup →