Skip to content

Instantly share code, notes, and snippets.

@scooooooooby
Last active August 29, 2015 14:16
Show Gist options
  • Save scooooooooby/3e91ec21c403c3b9b7ed to your computer and use it in GitHub Desktop.
Save scooooooooby/3e91ec21c403c3b9b7ed to your computer and use it in GitHub Desktop.
AutoCommand: Prompt for commit message on save (Vim)
autocmd BufWritePost * let message = input('Commit message: ', '' . expand('')) | execute ':silent ! if git rev-pars e --git-dir > /dev/null 2>&1 ; then git add % ; git commit -m ' . shellescape(message, 1) . '; fi > /dev/null 2>&1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment