When you've made modifications to a file in vi(1) and then find that
you can't write it, type ``<ESC>!rm -f %'' then ``:w!'' to force the
write

This won't work if you don't have write permissions to the directory
and probably won't be suitable if you're editing through a symbolic link.

If you have sudo(8) installed and permissions to use it, type
``<ESC>w ! sudo tee %'' to force a write.

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.bsd.cafe/users/fbfortune/statuses/114377021798991253 on your instance and quote it. (Note that quoting is not supported in Mastodon.)