907th/vim-auto-save

Feature request: settings to exclude some files

milushov opened this issue · 2 comments

Hey, thanks for nice plugin!

I have autocmd command for auto sourcing my vimrc. And when the plugin is saving file I'm getting my vim unnecessary frozen during sourcing the config..

autocmd bufwritepost $MYVIMRC source $MYVIMRC

It would be nice to have a setting to ignore/exclude some files, smth like this:

let g:auto_save_files_ignore = [$MYVIMRC]

Btw I have these settings:

let g:auto_save = 1
" https://github.com/907th/vim-auto-save/issues/53#issuecomment-571819789
let g:auto_save_events = ["CursorHold"]
set updatetime=300

Btw2 I can donate few dollars for this feature!

907th commented

@milushov Hello, Roma!
I think that your feature request can be implement with a presave hook, like that:

" This will run AbortIfVimRc function before each save
let g:auto_save_presave_hook = 'call AbortIfVimRc()'
function! AbortIfVimRc()
  if <check that current file is vimrc somehow>
    let g:auto_save_abort = 1
  else
    let g:auto_save_abort = 0
  endif
endfunction

I don't know how to exactly <check that current file is vimrc>, but I believe you'll be able to google it easily yourself.
Thank you for getting in touch and for using my plugin!