Skip to content

Commit 6c54de3

Browse files
authored
Add g:suda#executable option (#58)
1 parent 08abd39 commit 6c54de3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

autoload/suda.vim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function! suda#system(cmd, ...) abort
22
let cmd = has('win32') || g:suda#nopass
3-
\ ? printf('sudo %s', a:cmd)
4-
\ : printf('sudo -p '''' -n %s', a:cmd)
3+
\ ? printf('%s %s', g:suda#executable, a:cmd)
4+
\ : printf('%s -p '''' -n %s', g:suda#executable, a:cmd)
55
if &verbose
66
echomsg '[suda]' cmd
77
endif
@@ -15,7 +15,7 @@ function! suda#system(cmd, ...) abort
1515
finally
1616
call inputrestore()
1717
endtry
18-
let cmd = printf('sudo -p '''' -S %s', a:cmd)
18+
let cmd = printf('%s -p '''' -S %s', g:suda#executable, a:cmd)
1919
return system(cmd, password . "\n" . (a:0 ? a:1 : ''))
2020
endfunction
2121

@@ -265,3 +265,4 @@ augroup END
265265
" Configure
266266
let g:suda#nopass = get(g:, 'suda#nopass', 0)
267267
let g:suda#prompt = get(g:, 'suda#prompt', 'Password: ')
268+
let g:suda#executable = get(g:, 'suda#executable', 'sudo')

doc/suda.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ suda#write({expr} [, {options}])
160160
-----------------------------------------------------------------------------
161161
VARIABLE *suda-interface-variable*
162162

163+
*g:suda#executable*
164+
A executable of "sudo" command.
165+
Default: "sudo"
166+
163167
*g:suda#nopass*
164168
If set, suda will not prompt you for a password before saving a file.
165169
It is suppossed to support a setup with passwordless sudo or doas.

0 commit comments

Comments
 (0)