2014-02-11 18:09:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-12-30 03:29:00 +01:00
|
|
|
# Privileged mode, ignores $CDPATH etc.
|
|
|
|
set -p
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
2014-02-11 18:09:24 +01:00
|
|
|
|
2015-05-28 12:03:49 +02:00
|
|
|
export BASE="$PWD"
|
|
|
|
export PLUG_SRC="$PWD/../plug.vim"
|
|
|
|
export PLUG_FIXTURES="$PWD/fixtures"
|
|
|
|
mkdir -p "$PLUG_FIXTURES"
|
2016-06-16 15:17:03 +02:00
|
|
|
export TEMP=/tmp/vim-plug-test
|
|
|
|
rm -rf "$TEMP"
|
|
|
|
mkdir -p "$TEMP"
|
2015-05-28 12:03:49 +02:00
|
|
|
|
2016-06-16 15:17:03 +02:00
|
|
|
cat > $TEMP/mini-vimrc << VIMRC
|
|
|
|
set rtp+=$TEMP/junegunn/vader.vim
|
2015-05-28 12:03:49 +02:00
|
|
|
set shell=/bin/bash
|
|
|
|
VIMRC
|
2014-10-19 07:45:19 +02:00
|
|
|
|
2015-01-07 12:14:48 +01:00
|
|
|
clone() {
|
2016-12-30 03:29:00 +01:00
|
|
|
if [ ! -d "$2" ]; then
|
|
|
|
git clone "$1" "$2"
|
2015-01-07 12:14:48 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-12-22 15:12:02 +01:00
|
|
|
clone_repos() (
|
2016-06-16 15:17:03 +02:00
|
|
|
cd $TEMP
|
2015-05-28 12:03:49 +02:00
|
|
|
mkdir -p junegunn vim-scripts jg
|
|
|
|
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
|
|
|
vim-oblique vim-pseudocl vim-redis vim-emoji; do
|
|
|
|
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
|
|
|
|
done
|
|
|
|
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
|
|
|
|
clone https://github.com/junegunn/fzf.git fzf &
|
2016-04-03 03:52:30 +02:00
|
|
|
clone https://github.com/yous/subsubmodule.git yous/subsubmodule && \
|
|
|
|
(cd yous/subsubmodule && git submodule update --init --recursive &) &
|
2015-05-28 12:03:49 +02:00
|
|
|
wait
|
2014-02-11 18:09:24 +01:00
|
|
|
|
2015-05-28 12:03:49 +02:00
|
|
|
clone junegunn/vim-emoji jg/vim-emoji
|
|
|
|
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
|
2015-12-22 15:12:02 +01:00
|
|
|
)
|
2015-01-07 12:14:48 +01:00
|
|
|
|
2015-12-22 15:12:02 +01:00
|
|
|
make_dirs() (
|
2015-05-28 12:03:49 +02:00
|
|
|
rm -rf "$PLUG_FIXTURES/$1"
|
2014-10-19 07:45:19 +02:00
|
|
|
mkdir -p "$PLUG_FIXTURES/$1"
|
|
|
|
cd "$PLUG_FIXTURES/$1"
|
2014-07-31 09:34:41 +02:00
|
|
|
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
|
|
|
for d in *; do
|
2016-12-30 03:29:00 +01:00
|
|
|
[ -d "$d" ] || continue
|
|
|
|
cat > "$d/xxx.vim" << EOF
|
2014-07-31 09:34:41 +02:00
|
|
|
" 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
|
2015-12-22 15:12:02 +01:00
|
|
|
)
|
2014-07-31 09:34:41 +02:00
|
|
|
|
2015-12-22 15:12:02 +01:00
|
|
|
gitinit() (
|
|
|
|
cd "$PLUG_FIXTURES/$1"
|
|
|
|
git init
|
|
|
|
git commit -m 'commit' --allow-empty
|
|
|
|
)
|
2014-09-27 08:19:11 +02:00
|
|
|
|
2015-05-28 12:03:49 +02:00
|
|
|
prepare() {
|
2014-09-27 08:19:11 +02:00
|
|
|
make_dirs xxx/ xxx
|
|
|
|
make_dirs xxx/after xxx
|
2015-05-28 12:03:49 +02:00
|
|
|
mkdir -p "$PLUG_FIXTURES/xxx/doc"
|
|
|
|
cat > "$PLUG_FIXTURES/xxx/doc/xxx.txt" << DOC
|
2014-08-09 05:02:03 +02:00
|
|
|
hello *xxx*
|
|
|
|
DOC
|
2015-12-22 15:12:02 +01:00
|
|
|
gitinit xxx
|
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
|
2017-09-24 16:59:28 +02:00
|
|
|
mkdir -p "$PLUG_FIXTURES/yyy/rtp/doc"
|
|
|
|
cat > "$PLUG_FIXTURES/yyy/rtp/doc/yyy.txt" << DOC
|
|
|
|
hello *yyy*
|
|
|
|
DOC
|
2015-12-22 15:12:02 +01:00
|
|
|
gitinit 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
|
2015-01-08 15:21:32 +01:00
|
|
|
|
2015-05-28 12:03:49 +02:00
|
|
|
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
2018-09-12 06:40:33 +02:00
|
|
|
mkdir -p "$PLUG_FIXTURES"/ftplugin-msg/{plugin,ftplugin}
|
2016-05-23 06:10:44 +02:00
|
|
|
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
|
|
|
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
|
2014-08-10 06:08:48 +02:00
|
|
|
|
2016-06-16 15:17:03 +02:00
|
|
|
rm -rf $TEMP/new-branch
|
|
|
|
cd $TEMP
|
2015-05-28 12:03:49 +02:00
|
|
|
git init new-branch
|
|
|
|
cd new-branch
|
|
|
|
mkdir plugin
|
|
|
|
echo 'let g:foo = 1' > plugin/foo.vim
|
|
|
|
git add plugin/foo.vim
|
|
|
|
git commit -m initial
|
2017-02-25 19:34:59 +01:00
|
|
|
git checkout -b plugin
|
|
|
|
git checkout master
|
2015-05-28 12:03:49 +02:00
|
|
|
|
|
|
|
cd "$BASE"
|
|
|
|
}
|
2014-06-23 05:47:13 +02:00
|
|
|
|
2015-11-28 16:00:49 +01:00
|
|
|
select_vim() {
|
|
|
|
local vim=/usr/bin/vim
|
2016-12-30 03:29:00 +01:00
|
|
|
if [ -n "${DEPS:-}" ] && [ -e "${DEPS}/bin/vim" ]; then
|
2015-11-28 16:00:49 +01:00
|
|
|
vim="${DEPS}/bin/vim"
|
|
|
|
elif [ -e "/usr/local/bin/vim" ]; then
|
|
|
|
vim=/usr/local/bin/vim
|
|
|
|
fi
|
|
|
|
echo $vim
|
|
|
|
}
|
|
|
|
|
2015-05-28 12:03:49 +02:00
|
|
|
clone_repos
|
|
|
|
prepare
|
2015-11-28 16:00:49 +01:00
|
|
|
|
2016-04-16 22:47:30 +02:00
|
|
|
git --version
|
2017-01-01 04:08:09 +01:00
|
|
|
vim=$(select_vim)
|
|
|
|
echo "Selected Vim: $vim"
|
2016-12-30 03:29:00 +01:00
|
|
|
if [ "${1:-}" = '!' ]; then
|
2017-01-01 04:08:09 +01:00
|
|
|
$vim -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
2015-05-28 12:03:49 +02:00
|
|
|
prepare &&
|
2017-01-01 04:08:09 +01:00
|
|
|
$vim -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
2014-06-23 05:47:13 +02:00
|
|
|
else
|
2017-01-01 04:08:09 +01:00
|
|
|
$vim -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
|
2014-06-23 05:47:13 +02:00
|
|
|
fi
|