Skip to content

Instantly share code, notes, and snippets.

@kuuote
Created September 30, 2020 09:28
Show Gist options
  • Save kuuote/7cdc53d57cb4910e1ac1c460f70022a3 to your computer and use it in GitHub Desktop.
Save kuuote/7cdc53d57cb4910e1ac1c460f70022a3 to your computer and use it in GitHub Desktop.
Vimのプラグインを気軽に試すやつ
#!/bin/bash -u
tmp=$(mktemp -d)
atexit() {
sudo rm -rf ${tmp}
}
trap atexit EXIT
addrepo() {
local url="$1"
local repo="${HOME}/.cache/templug/${url}"
echo "${repo}"
if [[ ! -d "${repo}" || ! -z "${update:-}" ]]; then
mkdir -p "$(dirname ${repo})"
rm -rf "${repo}"
git clone --depth=1 "${url}" "${repo}"
fi
echo "set rtp+=${repo}" >> "${tmp}/vimrc"
}
truncate -s0 "${tmp}/vimrc"
while (( $# != 0 )); do
case "$1" in
-u)
update=true
;;
*)
addrepo "$1"
;;
esac
shift
done
echo "source ~/.vim/vimrc" >> "${tmp}/vimrc"
vim -u "${tmp}/vimrc" -N
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment