From f9134bb20f370e42d8b2dab20c0bbe7cd3eaf061 Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Wed, 21 Aug 2019 16:46:12 +0800 Subject: [PATCH] Update vimrc auto save --- .vim/startup/vundle_vimrc | 6 +++++- .vimrc | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.vim/startup/vundle_vimrc b/.vim/startup/vundle_vimrc index 267b0a6..e41bcea 100644 --- a/.vim/startup/vundle_vimrc +++ b/.vim/startup/vundle_vimrc @@ -64,7 +64,8 @@ Plug 'mattn/emmet-vim', { 'for': ['html', 'javascript'] } Plug 'MarcWeber/vim-addon-mw-utils' Plug 'tomtom/tlib_vim' Plug 'garbas/vim-snipmate' - +Plug 'ntpeters/vim-better-whitespace' +Plug '907th/vim-auto-save' " Git plugin not hosted on GitHub Plug 'git://git.wincent.com/command-t.git' @@ -173,3 +174,6 @@ let g:ack_use_cword_for_empty_search = 1 let g:ack_use_dispatch = 1 " autofold results let g:ack_autofold_results = 1 + +let g:auto_save = 1 " enable AutoSave on Vim startup + diff --git a/.vimrc b/.vimrc index 8320a1f..7e1e671 100644 --- a/.vimrc +++ b/.vimrc @@ -260,17 +260,17 @@ autocmd CursorHold, CursorHoldI * update set autowrite set autowriteall -let g:autosave_time_period = 10 -au BUfRead,BufNewFile * let b:start_time=localtime() -" only write if needed and update the start time after save -function! UpdateFile() - if ((localtime() - b:start_time) >= g:autosave_time_period) - update - echo "Time: " . (localtime() - b:start_time) . " seconds have elapsed. File saved." - let b:start_time=localtime() - endif -endfunction -au CursorHold * call UpdateFile() +" let g:autosave_time_period = 10 +" au BUfRead,BufNewFile * let b:start_time=localtime() +" " only write if needed and update the start time after save +" function! UpdateFile() +" if ((localtime() - b:start_time) >= g:autosave_time_period) +" update +" echo "Time: " . (localtime() - b:start_time) . " seconds have elapsed. File saved." +" let b:start_time=localtime() +" endif +" endfunction +" au CursorHold * call UpdateFile() " general mapping " no ddkP