Sunday, December 23, 2012

Re: Vim and Windows User Account Control (UAC)

>On Wed, December 19, 2012 15:33, Ben Fritz wrote:
>> On Wednesday, December 19, 2012 3:52:01 AM UTC-6, Boris Danilov wrote:
>>> Hello! Vim is great editor, but I have some trouble when working under
>>> normal user account and editing files in places with restricted access
>>> (like
>>> Program Files and etc.). Is there a way to make Vim elevate access
>>> rights when saving a file? I want Vim to display me the UAC dialogue
>>> where
>>> I must confirm the operation instead of giving me a message that write
>>> failed? Is there anything I can do without running Vim under
>>> administrator
>>> privilegies or disabling UAC?
>>>
>>
>> I'm pretty sure you're stuck launching Vim with admin privileges.
>>
>> You might be able to hack something together with one or more of these
>> search results:
>>
>> https://www.google.com/search?q=windows+sudo+command
>>
>> But doing that you'd need to bypass Vim's normal write mechanisms,
>> probably with a BufWriteCmd autocmd. I think you're better off just
>> launching Vim with admin rights, as people basically do on Linux when
>> editing system files (using "sudo" to give root access).
>
>Also, please see this comment in my plugin SudoEdit:
>https://github.com/chrisbra/SudoEdit.vim/blob/master/doc/SudoEdit.txt#L143
>
>I would be interested in Windows users experiences.
>
>regards,
>Christian

Thanks for reposting this to the mailing list. SudoEdit is exactly what I
was looking for. Too bad it can't give me fancy UAC dialogue, but I don't
care. However, I've encountered a problem using SudoEdit. First it has a
misprint where the varialbe s:writable_file is being initialized in function
Init (where it is written as s:writEable_file there). Then I had to use the
following g:sudoAuthArg="/noprofile /user:Grin" in my vimrc, because my
Administrator account is renamed.

Then I'm getting the following output when I'm trying to save file test.vim
with :SudoWrite test2.vim.



It doesn't write the file and gives me an error message that file wasn't
written in Vim.

When I'm trying to save the file under the current filename with just
:SudoWrite I'm getting



This time when I return to Vim the last row says the file test.vim was
written, but actually it is not, when I reopen it. I have no idea what is
going wrong there, but I've thought it might be because of write != 'write'
so I've removed quotes from 'write' in cmd file, but it doesn't look to
change anything except that I'm getting another cmd launched because of /k
flag. That way it doesn't write anything or give any errors with this change
either.

Regards,
Boris



--
View this message in context: http://vim.1045645.n5.nabble.com/Vim-and-Windows-User-Account-Control-UAC-tp5712690p5712751.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: