--- /dev/null
+" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
+" Vimwiki support for having your wiki directory as a git repo.
+
+" We add to the vimwiki group
+if exists("g:vimwiki_list")
+ for w in g:vimwiki_list
+ augroup vimwiki
+ let home = w['path']."/index.wiki"
+ " Make sure this window's working dir is the wiki repo dir whenever home.md is opened
+ au! BufRead home lcd w['path']; echo "enabling vimwiki autogit";
+ " Also do a git pull whenever home.md is opened
+ au BufRead home !git pull
+ let wikifiles = w['path'] . "/*"
+ " After writing to any file in the wiki dir, add all files in the repo, commit and push
+ au! BufWritePost wikifiles !git add .;git commit -m "Autocommit and push"; git push
+ augroup END
+ endfor
+endif