Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions plugin/AutoSave.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ if !exists("g:auto_save_silent")
let g:auto_save_silent = 0
endif

if !exists("g:auto_save_noautocmd")
let g:auto_save_noautocmd = 0
endif

if !exists("g:auto_save_write_all_buffers")
let g:auto_save_write_all_buffers = 0
endif
Expand Down Expand Up @@ -88,11 +92,17 @@ function! AutoSave()
endfunction

function! DoSave()
let l:write_cmd = ""
if g:auto_save_noautocmd >= 1
let l:write_cmd .= "noautocmd" . " "
endif

let l:write_cmd .= "silent! w"
if g:auto_save_write_all_buffers >= 1
silent! wa
else
silent! w
let l:write_cmd .= "a"
endif

execute l:write_cmd
endfunction

function! AutoSaveToggle()
Expand All @@ -107,3 +117,5 @@ endfunction

let &cpo = s:save_cpo
unlet s:save_cpo

" vim:sw=2:ts=2: