forked from dam9000/kickstart-modular.nvim
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmirror.sh
More file actions
executable file
·50 lines (36 loc) · 1.22 KB
/
Copy pathmirror.sh
File metadata and controls
executable file
·50 lines (36 loc) · 1.22 KB
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
#!/usr/bin/env bash
mirror_mason_registry() {
target_dir="$mirror_dir/mason-registry"
git clone --mirror https://github.com/mason-org/mason-registry.git $target_dir || return
cd "$target_dir" || return
git config --bool core.bare false
}
mirror_nvim_plugin() {
echo "Processing: $full_name"
cd "$full_name" || return
local target_dir
target_dir="$mirror_dir/$(basename "$full_name")"
echo "Cloning mirror to: $target_dir"
git clone --mirror "$(git remote get-url origin)" "$target_dir" || return
cd "$target_dir" || return
git config --bool core.bare false
}
mirror_nvim_plugins() {
local plugin_dir="${XDG_DATA_HOME:-$HOME/.local/share}/nvim/site/pack/core/opt"
local mirror_dir="/tmp/mirror/plugins"
mkdir -p "$mirror_dir"
find "$plugin_dir" -mindepth 1 -maxdepth 1 -type d | while read -r full_name; do
if [ -d "$full_name/.git" ]; then
mirror_nvim_plugin "$full_name"
fi
done
mirror_mason_registry
}
rm -rf /tmp/mirror.zip || true
rm -rf /tmp/mirror || true
mkdir -p /tmp/mirror
git clone git@github.com:oriori1703/kickstart-modular.nvim.git /tmp/mirror/config-nvim
mirror_nvim_plugins
cp -r "${XDG_DATA_HOME:-$HOME/.local/share}/nvim/" /tmp/mirror/nvim-share
cd /tmp || exit 1
zip -r mirror.zip mirror