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 !
!
:!chmod
and if vi still doesn't want to write it,
:se cpo-=W