-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
28 lines (26 loc) · 786 Bytes
/
.vimrc
File metadata and controls
28 lines (26 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function ByShell(cmd)
write
call s:vimtime('scmd')
exec '!' . a:cmd
call s:vimtime('ecmd')
endfunction
let s:spared=0
function s:vimtime(event) abort
if expand('%:t') != '.vimtime' && @% != ''
if a:event != 'back' && s:spared == 1
call s:vimtime('back')
endif
silent exec '!echo %:t '.a:event.' '.localtime().' >> %:p:h/.vimtime'
if a:event == 'back'
let s:spared=0
endif
endif
endfunction
augroup vimtime
autocmd BufEnter * call s:vimtime('open')
autocmd BufLeave,VimLeave * call s:vimtime('clos')
autocmd InsertEnter * call s:vimtime('edit')
autocmd InsertLeave * call s:vimtime('norm')
autocmd CursorHold,CursorHoldI * call s:vimtime('spar') | let s:spared=1
autocmd CursorMoved,CursorMovedI * if s:spared==1 | call s:vimtime('back')
augroup END