I use vim to edit a file. Sometimes, I forget to have the appropriate permissions. I run vim and the file as a read only file. I can make changes, but I can't actually write the changes. Every once in a while, I end up opening a file and making changes to it, realize that I didn't run it in sudo, scream to myself , and then force quit and open it up again as root user.
Is there a workaround for this? Can I force the changes to the file despite the read only status of the file? Can I at least save the changes, run a diff, and merge the files together?