66 lines
1.4 KiB
Bash
Executable file
66 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
cd $(dirname $BASH_SOURCE)
|
|
cd ..
|
|
PLUG_SRC=$(pwd)/plug.vim
|
|
cd - > /dev/null
|
|
|
|
if [ ! -d vader.vim ]; then
|
|
git clone https://github.com/junegunn/vader.vim.git
|
|
fi
|
|
|
|
rm -rf fzf
|
|
if [ ! -d fzf-staged ]; then
|
|
git clone https://github.com/junegunn/fzf.git fzf-staged
|
|
fi
|
|
|
|
make_dirs() {
|
|
mkdir -p "temp/$1"
|
|
cd "temp/$1"
|
|
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
|
for d in *; do
|
|
[ -d $d ] || continue
|
|
cat > $d/xxx.vim << EOF
|
|
" echom expand('<sfile>')
|
|
let g:total_order = get(g:, 'total_order', [])
|
|
let g:$2 = get(g:, '$2', [])
|
|
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)
|
|
EOF
|
|
done
|
|
cd - > /dev/null
|
|
}
|
|
|
|
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
|
|
hello *xxx*
|
|
DOC
|
|
|
|
make_dirs yyy/ yyy
|
|
make_dirs yyy/after yyy
|
|
|
|
make_dirs z1/ z1
|
|
make_dirs z2/ z2
|
|
}
|
|
|
|
cat > /tmp/mini-vimrc << VIMRC
|
|
set rtp+=vader.vim
|
|
set shell=/bin/bash
|
|
source $PLUG_SRC
|
|
VIMRC
|
|
|
|
init
|
|
if [ "$1" = '!' ]; then
|
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null &&
|
|
init &&
|
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
|
|
else
|
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
|
|
fi
|
|
|