forked from nvim-neo-tree/neo-tree.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·74 lines (60 loc) · 2.38 KB
/
install.sh
File metadata and controls
executable file
·74 lines (60 loc) · 2.38 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
# An example install script for people using `:h packages`
export NEOTREE_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/${NVIM_APPNAME:-nvim}"
###########
# Options #
###########
# You can modify the /neo-tree*/ names here, depending on how you like to organize your packages.
export NEOTREE_DIR="${NEOTREE_DATA_HOME}/site/pack/neo-tree/start"
export NEOTREE_DEPS_DIR="${NEOTREE_DATA_HOME}/site/pack/neo-tree-deps/start"
export NEOTREE_OPTIONAL_DIR="${NEOTREE_DATA_HOME}/site/pack/neo-tree-optional/start"
# Modify the optional plugins you want below:
declare -a OPTIONAL_PLUGINS=(
"https://github.com/nvim-tree/nvim-web-devicons.git" # for file icons
# "https://github.com/antosha417/nvim-lsp-file-operations.git" # for LSP-enhanced renames/etc.
# "https://github.com/folke/snacks.nvim.git" # for image previews
# "https://github.com/3rd/image.nvim.git" # for image previews
# "https://github.com/s1n7ax/nvim-window-picker.git" # for _with_window_picker keymaps
)
###########################
# The rest of the script. #
###########################
ORIGINAL_DIR="$(pwd)"
clone_sparse() {
git clone --filter=blob:none "$@"
}
mkdir -p "${NEOTREE_DIR}" "${NEOTREE_DEPS_DIR}"
echo "Installing neo-tree..."
cd "${NEOTREE_DIR}"
clone_sparse -b v3.x https://github.com/nvim-neo-tree/neo-tree.nvim.git
echo "Installing core dependencies..."
cd "${NEOTREE_DEPS_DIR}"
clone_sparse https://github.com/nvim-lua/plenary.nvim.git
clone_sparse https://github.com/MunifTanjim/nui.nvim.git
if [ ${#OPTIONAL_PLUGINS[@]} -gt 0 ]; then
echo "Installing optional plugins..."
mkdir -p "${NEOTREE_OPTIONAL_DIR}"
cd "${NEOTREE_OPTIONAL_DIR}"
for repo in "${OPTIONAL_PLUGINS[@]}"; do
clone_sparse "$repo"
done
fi
echo "Regenerating help tags..."
declare -a PLUGIN_BASE_DIRS=(
"${NEOTREE_DIR}"
"${NEOTREE_DEPS_DIR}"
"${NEOTREE_OPTIONAL_DIR}"
)
# Loop through each base directory and find all 'doc' subdirectories using glob
shopt -s nullglob # Enable nullglob for safe globbing (empty array if no matches)
for base_dir in "${PLUGIN_BASE_DIRS[@]}"; do
# Check if the base directory exists
if [ -d "$base_dir" ]; then
for doc_path in "${base_dir}"/*/doc; do
nvim -u NONE --headless -c "helptags ${doc_path}" -c "q"
done
fi
done
shopt -u nullglob # Disable nullglob
echo "Installation complete!"
cd "${ORIGINAL_DIR}"