I am new to the world of Vim, and I want to make it so that every time I save a file it is commited to version control. Is this possible?
|
I use a vim autocommand which I place in my .vimrc. The command first does a crude check that we're working in a git directory (by checking existence of a .git directory), then uses
|
|||||||||
|
|
You surely could to this whit a macro or with command remapping. (Check http://stackoverflow.com/questions/117150/can-i-re-map-commands-in-vim) I'm not sure it's a good option though. I'm not proficient in git for now and I know it's sometimes different from svn. But I wouldn't do this auto-commit with svn. Commit needs to be meaningful and not some save at regular time. You normally commit because you added a function, fixed a bug, ... not just because you worked on a file. You won't end up with non compiling project or unfinished function. |
|||||
|
|
You could use Vim's autocommands:
That's untested but it should add the file and commit it with the filename as commit message. |
|||
|
|
|
You may want to look into the fugitive plugin, it's a very powerful git plugin for vim. You can also setup an |
|||
|
|
|
Building on the answers others have provided:
This is completely transparent. You won't get the "Press enter to continue" message (but if the commit didn't work, you won't know it failed). |
|||
|
|