Skip to content

Commit

Permalink
Handle E790 with undojoin
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored and chrisbra committed Nov 17, 2015
1 parent c9141df commit 898f85e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions autoload/SudoEdit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ fu! <sid>LocalSettings(values, readflag, file) "{{{2
"checktime
"let _ur=&ur
"setl ur=0
exe "undojoin | :e" file

" Call undojoin, but catch 'undojoin is not allowed after undo'.
try | undojoin | catch /^Vim\%((\a\+)\)\=:E790/ | endtry
exe "edit" file
"let &ur=_ur
" Reset old settings
let [ &srr, &l:ar, &t_ti, &t_te, &shell, &stmp, &ssl, &ur ] = values
Expand Down Expand Up @@ -326,7 +329,8 @@ fu! <sid>SudoWrite(file) range "{{{2
\ join(s:AuthTool, ' ') . cmd
endif
endif
let cmd=':undojoin |'.cmd
" Call undojoin, but catch 'undojoin is not allowed after undo'.
let cmd='try | undojoin | catch /^Vim\%((\a\+)\)\=:E790/ | endtry | '.cmd
if <sid>CheckNetrwFile(a:file) && exists(":NetUserPass") == 2
let protocol = matchstr(a:file, '^[^:]:')
call <sid>echoWarn('Using Netrw for writing')
Expand Down

0 comments on commit 898f85e

Please sign in to comment.