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 different 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.
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
.
上一篇: Emacs快捷键输入顺序