Answer by yatsek for Using vim to force edit a file when you opened without...
Just want to cover case when there is no file write permissions.:!chmod +w %:w!In between vim will complain about changes in file (because of flags change) - it's obviously safe to ignore them
View ArticleAnswer by DrBeco for Using vim to force edit a file when you opened without...
There seems to be some different approachs, depending on your current problem:Readonly by vi. If your file has :set readonly you canUse :w! to force write, orIssue :set noreadonly and then just use...
View ArticleAnswer by Billy McCloskey for Using vim to force edit a file when you opened...
I can think of two ways to do this.The first way assumes you own the file, but the file is READONLY.Just use vi's exclamation mark suffix to the write command (:w!) to force overwriting your own...
View ArticleAnswer by Jonathan Ben-Avraham for Using vim to force edit a file when you...
Another possibility, for the case in which you do not have sudo privileges, is to use :w /somewhere/where/i/have/permissions/foo.txt, and then deal with the permissions issue later, as per Ryan Fox.
View ArticleUsing vim to force edit a file when you opened without permissions
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...
View Article