+
+
+""" package config
+"" suda
+" https://github.com/lambdalisue/vim-suda/issues/32#issuecomment-829608925
+if ! &diff
+ let g:suda_smart_edit = 1
+endif
+" re-enable backup, swap, undo for suda buffers that we can read
+" https://github.com/lambdalisue/vim-suda/issues/25
+function s:SudaSettingsSave()
+ let b:sev_suda_backup = &backup
+ let b:sev_suda_swapfile = &swapfile
+ let b:sev_suda_undofile = &undofile
+endfunction
+function s:SudaSettingsRestore()
+ if filereadable(expand('<afile>')[7:])
+ if exists('b:sev_suda_backup') && b:sev_suda_backup
+ " XXX: suda.vim uses setlocal for this, even though it's global...
+ " https://github.com/lambdalisue/vim-suda/issues/85
+ setlocal backup
+ endif
+ if exists('b:sev_suda_swapfile') && b:sev_suda_swapfile
+ setlocal swapfile
+ endif
+ if exists('b:sev_suda_undofile') && b:sev_suda_undofile
+ setlocal undofile
+ endif
+ endif
+endfunction
+autocmd BufReadPre suda://* call s:SudaSettingsSave()
+autocmd BufReadPost suda://* call s:SudaSettingsRestore()