File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 33" {opts} should be *sudo-specific*, while {cmd} is passed to any suda#executable
44" Note: {cmd} can not have any sudo flags. Put these into {opts}, as '--' is passed before {cmd}
55" Similarly, {opts} should *not* contain '--'
6+ " Returns a string that is safe to pass to `system` on both vim and neovim
67function ! s: get_command (opts, cmd)
78 if g: suda #executable == # ' sudo'
8- return [g: suda #executable ] + a: opts + [' --' ] + a: cmd
9+ let ret = [g: suda #executable ] + a: opts + [' --' ] + a: cmd
10+ else
11+ " TODO:
12+ " Should we pass '--' before cmd when using a custom suda#executable?
13+ " Should suda#executable be split? Should we allow suda#executable to be a list instead?
14+ " This behavior is entirely undocumented
15+ let ret = [g: suda #executable ] + a: cmd
916 endif
10- " TODO:
11- " Should we pass '--' before cmd when using a custom suda#executable?
12- " Should suda#executable be split? Should we allow suda#executable to be a list instead?
13- " This behavior is entirely undocumented
14- return [g: suda #executable ] + a: cmd
17+
18+ " TODO: Should we detect `has('neovim')` and return a list to avoid a shell?
19+ return join (map (ret , { k , v - > shellescape (v ) }), ' ' )
1520endfunction
1621
1722" {cmd} is a argv list for the process
You can’t perform that action at this time.
0 commit comments