How to change file permission from within vi

前端 未结 7 1794
庸人自扰
庸人自扰 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:38

    Just use

    :!chmod +w %
    

    in command mode. % will be replaced by the current file name.

提交回复
热议问题