A config edit gets two moves around it: a copy before and a check after. Then a bad edit is undone with one command.
While you type, Vim changes the buffer — a copy of the file in the editor's memory. The file on disk changes only on :w. So correct text on the Vim screen does not yet mean another program will read the new version.
Before editing a config, copy the original: cp app.conf app.conf.bak. Take the copy before the edit, or it will hold the changed text. If the edit goes wrong, put the original back: cp app.conf.bak app.conf.
After leaving Vim, read the file with cat: that shows what is on disk.
Save a focused edit
In ~/text-lab, first copy app.conf to app.conf.bak. Then open app.conf in Vim, change port=8080 to port=9090 and keep mode=training. Save, quit, and read both files with cat.
Goals · 0 of 2
- Keep the original in app.conf.bak not done yet
- Change the port in app.conf to 9090 not done yet