When you install gvim in Windows, you get a right-click Explorer context menu item: "Edit with Vim". Is there a way of either adding a "Edit with Vim as Administrator", or just changing the existing shortcut to always open the file with Vim in Administrator mode? I tried setting gvim.exe
to always run as administrator, but that seems to break the context menu item; it gives the error "Error creating process: Check if gvim is in your path!"
UPDATE: magicandre1981 showed me a nice way of using nircmd to partially achieve what I want. Once I installed nircmd.exe to the windows system32 directory, adding this to the registry (putting it in a .reg
file and running it) added a context menu item that let me edit files as admin:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Edit with Vim as Administrator]
[HKEY_CLASSES_ROOT\*\shell\Edit with Vim as Administrator\command]
@="nircmd.exe elevate \"C:\\Program Files (x86)\\Vim\\vim74\\gvim.exe\" \"%1\""
It's still not quite as nicely integrated as I'd like though, as it doesn't use the Vim helper DLL and requires the use of the additional nircmd tool.