diff options
| author | nsfisis <nsfisis@gmail.com> | 2021-12-04 13:09:34 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2021-12-04 15:38:47 +0900 |
| commit | 7482bb03a7943a3fd9049c7ba61033b42387fac2 (patch) | |
| tree | c5dcb4a27b723ca6fc14a22366e4d2b9477c694a /.config/nvim/autoload/autosave.vim | |
| parent | 12f18a076f79470941f7ed54ac2de7effcbff740 (diff) | |
| download | dotfiles-7482bb03a7943a3fd9049c7ba61033b42387fac2.tar.gz dotfiles-7482bb03a7943a3fd9049c7ba61033b42387fac2.tar.zst dotfiles-7482bb03a7943a3fd9049c7ba61033b42387fac2.zip | |
neovim: refactor
Diffstat (limited to '.config/nvim/autoload/autosave.vim')
| -rw-r--r-- | .config/nvim/autoload/autosave.vim | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/.config/nvim/autoload/autosave.vim b/.config/nvim/autoload/autosave.vim deleted file mode 100644 index be64707..0000000 --- a/.config/nvim/autoload/autosave.vim +++ /dev/null @@ -1,64 +0,0 @@ -scriptencoding utf-8 - - - -if !exists('g:autosave_interval_ms') - let g:autosave_interval_ms = 10 * 1000 -endif - -if !exists('g:autosave_silent') - let g:autosave_silent = v:true -endif - - - -function! autosave#handler(timer_id) abort - if !&modified - return - endif - if &readonly - return - endif - if &buftype !=# '' - return - endif - if expand('%') ==# '' - return - endif - - if !g:autosave_silent - echohl Comment - echo 'Auto-saving...' - echohl None - endif - - silent! write - - if !g:autosave_silent - echohl Comment - echo 'Saved.' - echohl None - endif -endfunction - - -function! autosave#enable() abort - if exists('b:autosave_timer') - return - endif - - let b:autosave_timer = timer_start( - \ g:autosave_interval_ms, - \ 'autosave#handler', - \ { 'repeat': -1 }) -endfunction - - -function! autosave#disable() abort - if !exists('b:autosave_timer') - return - endif - - call timer_stop('b:autosave_timer') - unlet b:autosave_timer -endfunction |
