Created
September 30, 2020 09:28
-
-
Save kuuote/7cdc53d57cb4910e1ac1c460f70022a3 to your computer and use it in GitHub Desktop.
Vimのプラグインを気軽に試すやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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