Created
August 3, 2014 12:27
-
-
Save syui/b8176fc83d42c105c7f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
dir=${0:a:h}"/vimrc" | |
mkdir -p $dir | |
# github, bitbucket {{{ | |
dot=`curl http://vim-jp.org/reading-vimrc/json/archives.json | jq -r '.[] | .vimrc | .[] | .url' | sed -e 's/\/github.com/\/raw.githubusercontent.com/g' -e 's/\/blob//g' -e 's/\/gist.github.com/\/gist.githubusercontent.com\/thinca/g' -e 's/\/src/\/raw/g'` | |
line=`echo $dot | wc -l | tr -d ' '` | |
for ((i = $line ; i > 0 ; i-- )) | |
do | |
repo=`echo $dot | awk "NR==$i"` | |
file=`echo $repo | cut -d '/' -f 4` | |
file=$dir/$file | |
curl $repo -o $file | |
done | |
# github, bitbucket }}} | |
# gist {{{ | |
dot=`echo $dot | grep "gist.githubusercontent.com" | sed 's/$/\/raw/g'` | |
line=`echo $dot | wc -l | tr -d ' '` | |
for ((i = $line ; i > 0 ; i-- )) | |
do | |
repo=`echo $dot | awk "NR==$i"` | |
file=`echo $repo | cut -d '/' -f 5` | |
file=$dir/$file | |
curl $repo -o $file | |
done | |
# gist }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment