开发者

how to i save a file as root in vim under windows

I sometimes open files in vim which have admin only permissions, such as config files in the program files. I edit these and attempt to save them only to discover that the file is readonly and I can't save in the original location. I have to save the file in a differe开发者_如何学JAVAnt place a copy it over the top.

I want to just issue a vim command to run the write as root, is this possible?

There is a unix verison here using sudo and tee What are the dark corners of Vim your mom never told you about?


The only way I know of is to open the file as admin in the first place. I know in Windows 7, you're given the option to 'Open' or 'Open as Administrator'.

I think is similar to vim in unix, such that you have to open the editor with sudo in the first place.


Unfortunately, the Run As Administrator does not show up in my case as seen below.

how to i save a file as root in vim under windows

So I went to 'Properties' as seen in the above image and under 'Security>Edit', seen below, enabled 'Full control' to my user. Though this is not as secure as Run As Administrator.

how to i save a file as root in vim under windows

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜