I sometimes open a read-only file in vi, forgetting to do chmod +w before opening it. Is there way to change the file from within vi?
chmod +w
Something like !
!
Just use
:!chmod +w %
in command mode. % will be replaced by the current file name.