vim-auto-save icon indicating copy to clipboard operation
vim-auto-save copied to clipboard

Feature request: settings to exclude some files

Open milushov opened this issue 5 years ago • 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!

milushov avatar Sep 26 '20 22:09 milushov

@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!

907th avatar Sep 28 '20 06:09 907th