If you're using full vim, you can use ":w /path/to/filename"
In busybox's vi, you need to manually override the read-only, ie ":w! /path/to/filename"
The problem is one of permissions, in which case w! doesn't work for either vim or vi. (ie.,root:root)
It seems that after losing a few edits by not using "sudo vi", I begin to use "sudo" for everything...including writing the initial file. (i.e., sudo vi /dir/new_file) or even "sudo mkdir". Now everything is root:root, and if I fail to use "sudo" when editing, I lose it. This serves to once again increase my use of "sudo" for everything....since then I never have to know what the underlying permissions are for the file I just opened.
It gets further complicated if I write a new file without sudo within a root:staff or root:root folder. Now I can't save what I wrote, because I would have had to initiate the new file with "sudo'. Once again, I start using
sudo for everything.
EDIT: the work around, of course, is to change the permissions from the terminal,,,which allows
me to save what I wrote. Chown is fast becoming one of my other favorite words. (( finally figured this out after rewriting edits several times). Other incentives for "sudo" include trying to remove a folder without it, and having to go through a questionaire regarding every file inside it. "Sudo" effectively dumps the whole thing instantly....and I'm hooked!