Skip to content

Instantly share code, notes, and snippets.

@oelmekki
Created March 9, 2009 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oelmekki/76390 to your computer and use it in GitHub Desktop.
Save oelmekki/76390 to your computer and use it in GitHub Desktop.
if exists('trackloaded')
finish
endif
" list of autocmd events:
" http://www.vim.org/htmldoc/autocmd.html#autocmd-events
let trackfile = '/tmp/timetrack.dat'
let trackloaded = 1
execute 'autocmd InsertEnter * call Track("begin")'
execute 'autocmd InsertLeave * call Track("end")'
function Track(movment)
let l:filename = @%
if l:filename != g:trackfile
if match(l:filename, '/') != 0
let l:filename = getcwd().'/'.l:filename
endif
silent execute '!echo `date +\%s` '.a:movment.' '.l:filename.' >> '.g:trackfile
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment