-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·33 lines (27 loc) · 934 Bytes
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# update from current snippets to vim_plugins.tar.gz
if [[ ! -d ~/.vim/snippets ]]; then
echo "Error : no current snippets"
exit 1
fi
tar xzf ./vim_plugins.tar.gz
unzip -q ./vim_plugins/snipMate.zip -d ./vim_plugins/snipMate
snippets=`ls -1 ~/.vim/snippets`
for snippet in ${snippets}; do
diff ~/.vim/snippets/${snippet} ./vim_plugins/snipMate/snippets/${snippet} &> /dev/null
ret=`echo $?`
if [[ ${ret} -eq 1 ]]; then
cp ~/.vim/snippets/${snippet} ./vim_plugins/snipMate/snippets/${snippet}
echo "update ${snippet}"
elif [[ ${ret} -eq 2 ]]; then
cp ~/.vim/snippets/${snippet} ./vim_plugins/snipMate/snippets/${snippet}
echo "add ${snippet}"
fi
done
cd ./vim_plugins/snipMate
zip -rmq snipMate.zip *
cd ../..
mv ./vim_plugins/snipMate/snipMate.zip ./vim_plugins
rm -rf ./vim_plugins/snipMate
tar czf ./vim_plugins.tar.gz ./vim_plugins
rm -rf ./vim_plugins