Reputation: 10685
My test.pl was under control of the Perl debugger. I forgot that, and tried to modify the file, but vim told me the file was protected against writes and showed an RO in the status line. (I'm using gVim.)
I closed the debugger, and checked the protections on test.pl
-rwxrwxr-x 1 ics ics 494 Jul 3 15:25 test.pl
Even when I performed an e! on test.pl (using ftp:// syntax); closed test.pl and re-opened the file, it was still showing RO. I had to close vim; restart it; and upon loading test.pl again, its protections were correct.
How can I clear the RO flag without exiting vim?
Upvotes: 3
Views: 1803
Reputation: 263197
Just type
:se noro
which is short for:
:set noreadonly
(followed by Enter, of course).
That will tell vim that you're not editing the file in read-only mode, but it won't override any system-level protections if you don't have permission to write to it. (There might be resaons other than the directory permission bits that you wouldn't be able to write to a file; for example, the file might be locked or on a read-only file system.)
Upvotes: 3