Browse Source

Update vimrc auto save

pull/4/head
Ein Verne 5 years ago
parent
commit
f9134bb20f
No known key found for this signature in database
GPG Key ID: F80B65F734D9DD7D
  1. 6
      .vim/startup/vundle_vimrc
  2. 22
      .vimrc

6
.vim/startup/vundle_vimrc

@ -64,7 +64,8 @@ Plug 'mattn/emmet-vim', { 'for': ['html', 'javascript'] }
Plug 'MarcWeber/vim-addon-mw-utils' Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim' Plug 'tomtom/tlib_vim'
Plug 'garbas/vim-snipmate' Plug 'garbas/vim-snipmate'
Plug 'ntpeters/vim-better-whitespace'
Plug '907th/vim-auto-save'
" Git plugin not hosted on GitHub " Git plugin not hosted on GitHub
Plug 'git://git.wincent.com/command-t.git' 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 let g:ack_use_dispatch = 1
" autofold results " autofold results
let g:ack_autofold_results = 1 let g:ack_autofold_results = 1
let g:auto_save = 1 " enable AutoSave on Vim startup

22
.vimrc

@ -260,17 +260,17 @@ autocmd CursorHold, CursorHoldI * update
set autowrite set autowrite
set autowriteall set autowriteall
let g:autosave_time_period = 10 " let g:autosave_time_period = 10
au BUfRead,BufNewFile * let b:start_time=localtime() " au BUfRead,BufNewFile * let b:start_time=localtime()
" only write if needed and update the start time after save " " only write if needed and update the start time after save
function! UpdateFile() " function! UpdateFile()
if ((localtime() - b:start_time) >= g:autosave_time_period) " if ((localtime() - b:start_time) >= g:autosave_time_period)
update " update
echo "Time: " . (localtime() - b:start_time) . " seconds have elapsed. File saved." " echo "Time: " . (localtime() - b:start_time) . " seconds have elapsed. File saved."
let b:start_time=localtime() " let b:start_time=localtime()
endif " endif
endfunction " endfunction
au CursorHold * call UpdateFile() " au CursorHold * call UpdateFile()
" general mapping " general mapping
" no <up> ddkP " no <up> ddkP

Loading…
Cancel
Save