prepare for new laptop
[dotfiles.git] / vim / .vim / after / plugin / vimwiki-git.vim
1 " vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
2 " Vimwiki support for having your wiki directory as a git repo.
3
4 " We add to the vimwiki group
5 if exists("g:vimwiki_list")
6 for w in g:vimwiki_list
7 augroup vimwiki
8 let home = w['path']."/index.wiki"
9 " Make sure this window's working dir is the wiki repo dir whenever home.md is opened
10 au! BufRead home lcd w['path']; echo "enabling vimwiki autogit";
11 " Also do a git pull whenever home.md is opened
12 au BufRead home !git pull
13 let wikifiles = w['path'] . "/*"
14 " After writing to any file in the wiki dir, add all files in the repo, commit and push
15 au! BufWritePost wikifiles !git add .;git commit -m "Autocommit and push"; git push
16 augroup END
17 endfor
18 endif