Skip to content

Instantly share code, notes, and snippets.

@carlwoodward
Created April 7, 2013 12:35
Show Gist options
  • Save carlwoodward/5330325 to your computer and use it in GitHub Desktop.
Save carlwoodward/5330325 to your computer and use it in GitHub Desktop.
Add a line every time a file is opened or saved to ~/vim_files.csv. Tracks git branch and commit. Useful for time tracking. NOTE: this does slow down your save slightly.
autocmd BufWritePre,BufRead * exec 'silent :! echo "%:p,`date`,`if [ -d $(pwd)/.git ]; then GIT_DIR=$(pwd)/.git git rev-parse --abbrev-ref HEAD; fi`,`if [ -d $(pwd)/.git ]; then GIT_DIR=$(pwd)/.git git log --pretty=format:\"\%h\" -n 1; fi`" >> ~/vim_files.csv &'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment