Skip to content

Commit

Permalink
Use sudo -e to drive reading/writing
Browse files Browse the repository at this point in the history
This means permissions for sudoedit will be used rather than cat/tee,
which could mean fewer password prompts.
  • Loading branch information
tpope committed Apr 6, 2014
1 parent b7a453f commit fc74446
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/eunuch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ endfunction

function! s:SudoReadCmd() abort
silent %delete_
execute (has('gui_running') ? '' : 'silent') 'read !sudo cat %'
execute (has('gui_running') ? '' : 'silent') 'read !env SUDO_EDITOR=cat sudo -e %'
silent 1delete_
set nomodified
endfunction

function! s:SudoWriteCmd() abort
execute (has('gui_running') ? '' : 'silent') 'write !sudo tee % >/dev/null'
execute (has('gui_running') ? '' : 'silent') 'write !env SUDO_EDITOR=tee sudo -e % >/dev/null'
let &modified = v:shell_error
endfunction

Expand Down

0 comments on commit fc74446

Please sign in to comment.