vim-suda icon indicating copy to clipboard operation
vim-suda copied to clipboard

Prompt on new buffer with g:suda_smart_edit and g:suda#nopass

Open acamso opened this issue 10 months ago • 5 comments

A prompt is displayed when creating a new buffer / non-existent file that requires sudo using the following config:

set runtimepath =$NVIM_PLUGINS/suda.vim
let g:suda_smart_edit = 1
let g:suda#nopass = 1

I think v:shell_error is set to "1" because the file doesn't exist.

acamso avatar Oct 14 '23 11:10 acamso

Well, I'm sorry but I don't get your situation. Could you provide more details?

lambdalisue avatar Oct 18 '23 05:10 lambdalisue

If I open a new buffer / window for a new file that requires root access, I am still prompted for a password even with let g:suda#nopass = 1 set.

I think the problem is in autoload/suda.vim function! suda#system(cmd, ...). v:shell_error is set to "1" because the file doesn't exist yet, so it doesn't return and proceeds to the prompt.

acamso avatar Oct 18 '23 17:10 acamso

Make sense. I'm not sure if it can be solved easily but this should be an enhancement.

lambdalisue avatar Oct 23 '23 15:10 lambdalisue

Thanks - if I get to it I will submit a pull request.

acamso avatar Oct 24 '23 10:10 acamso

I believe this is the same issue as #61, which I describe here: https://github.com/lambdalisue/suda.vim/issues/61#issuecomment-1990924321

aarondill avatar Mar 12 '24 07:03 aarondill