Skip to content

Instantly share code, notes, and snippets.

@syui
Created August 3, 2014 12:27
Show Gist options
  • Save syui/b8176fc83d42c105c7f8 to your computer and use it in GitHub Desktop.
Save syui/b8176fc83d42c105c7f8 to your computer and use it in GitHub Desktop.
#!/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