2014-02-11 18:09:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cd $(dirname $BASH_SOURCE)
|
|
|
|
cd ..
|
|
|
|
PLUG_SRC=$(pwd)/plug.vim
|
|
|
|
cd - > /dev/null
|
|
|
|
|
2014-06-23 05:47:13 +02:00
|
|
|
if [ ! -d vader.vim ]; then
|
|
|
|
git clone https://github.com/junegunn/vader.vim.git
|
|
|
|
fi
|
2014-02-11 18:09:24 +01:00
|
|
|
|
2014-07-16 12:52:58 +02:00
|
|
|
rm -rf fzf
|
|
|
|
if [ ! -d fzf-staged ]; then
|
|
|
|
git clone https://github.com/junegunn/fzf.git fzf-staged
|
|
|
|
fi
|
|
|
|
|
2014-07-31 09:34:41 +02:00
|
|
|
make_dirs() {
|
2014-09-27 07:41:57 +02:00
|
|
|
mkdir -p "temp/$1"
|
|
|
|
cd "temp/$1"
|
2014-07-31 09:34:41 +02:00
|
|
|
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
|
|
|
for d in *; do
|
2014-09-22 17:21:48 +02:00
|
|
|
[ -d $d ] || continue
|
2014-07-31 09:34:41 +02:00
|
|
|
cat > $d/xxx.vim << EOF
|
|
|
|
" echom expand('<sfile>')
|
2014-09-22 17:21:48 +02:00
|
|
|
let g:total_order = get(g:, 'total_order', [])
|
2014-08-10 06:08:48 +02:00
|
|
|
let g:$2 = get(g:, '$2', [])
|
2014-09-22 17:21:48 +02:00
|
|
|
let s:name = join(filter(['$2', '${1:4}', '$d'], '!empty(v:val)'), '/')
|
|
|
|
call add(g:$2, s:name)
|
|
|
|
call add(g:total_order, s:name)
|
2014-07-31 09:34:41 +02:00
|
|
|
EOF
|
|
|
|
done
|
|
|
|
cd - > /dev/null
|
|
|
|
}
|
|
|
|
|
2014-09-27 08:19:11 +02:00
|
|
|
init() {
|
|
|
|
rm -rf temp/{xxx,yyy,z1,z2}
|
|
|
|
|
|
|
|
make_dirs xxx/ xxx
|
|
|
|
make_dirs xxx/after xxx
|
|
|
|
mkdir -p temp/xxx/doc
|
|
|
|
cat > temp/xxx/doc/xxx.txt << DOC
|
2014-08-09 05:02:03 +02:00
|
|
|
hello *xxx*
|
|
|
|
DOC
|
2014-07-31 09:34:41 +02:00
|
|
|
|
2014-09-27 08:19:11 +02:00
|
|
|
make_dirs yyy/ yyy
|
|
|
|
make_dirs yyy/after yyy
|
2014-09-22 17:21:48 +02:00
|
|
|
|
2014-09-27 08:19:11 +02:00
|
|
|
make_dirs z1/ z1
|
|
|
|
make_dirs z2/ z2
|
|
|
|
}
|
2014-08-10 06:08:48 +02:00
|
|
|
|
2014-06-23 05:47:13 +02:00
|
|
|
cat > /tmp/mini-vimrc << VIMRC
|
|
|
|
set rtp+=vader.vim
|
2014-08-01 16:16:21 +02:00
|
|
|
set shell=/bin/bash
|
2014-02-11 18:09:24 +01:00
|
|
|
source $PLUG_SRC
|
2014-06-23 05:47:13 +02:00
|
|
|
VIMRC
|
|
|
|
|
2014-09-27 08:19:11 +02:00
|
|
|
init
|
2014-06-23 05:47:13 +02:00
|
|
|
if [ "$1" = '!' ]; then
|
2014-07-16 12:52:58 +02:00
|
|
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null &&
|
2014-09-27 08:19:11 +02:00
|
|
|
init &&
|
2014-07-16 12:52:58 +02:00
|
|
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
|
2014-06-23 05:47:13 +02:00
|
|
|
else
|
|
|
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
|
|
|
|
fi
|
2014-02-11 18:09:24 +01:00
|
|
|
|