907th/vim-auto-save pre-save git hook - only save files under git (or any other scm you can think of) Inspired by vim-rooter
Use your favorite package manger
Just install this package and 907th/vim-auto-save and all your git files will be automatically saved. All other files will have to be saved manually.
A lot of the options are taken from vim rooter. for a more detailed explanation view vim-rooter's README file
To specify how to identify a project's root directory:
" .vimrcletg:git_patterns= ['.git', '.git/', '_darcs/', '.hg/', '.bzr/', '.svn/']" default valuesBy default all files and directories trigger git-auto-save. Configure a comma separated list of file patterns to specify which files trigger git-auto-save. Include / to trigger git-auto-save on directories.
" directories and all files (default)letg:git_targets='/,*'" ignore directories; all filesletg:git_targets='*'" ignore directories; yaml filesletg:git_targets='*.yml,*.yaml'" directories and yaml filesletg:git_targets='/,*.yml,*.yaml'By default git-auto-save doesn't resolve symbolic links. To resolve links:
letg:git_resolve_links=1My preferred settings:
" .vimrcletg:auto_save=1letg:auto_save_silent=1letg:auto_save_events= ["CursorHold"]
letupdatetime=4000None