How to change file permission from within vi

前端 未结 7 1808
庸人自扰
庸人自扰 2021-02-02 09:58

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?

Something like !

7条回答
  •  南笙
    南笙 (楼主)
    2021-02-02 10:32

    :!chmod  
    

    and if vi still doesn't want to write it,

    :se cpo-=W
    

提交回复
热议问题