-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·106 lines (87 loc) · 2.89 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·106 lines (87 loc) · 2.89 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Neovim setup for macOS
# Run from inside ~/mac_nvim (or wherever this folder lives):
# bash install.sh
# Installs neovim, build deps, LSP servers, tree-sitter CLI, packer.nvim,
# and copies the bundled nvim config into ~/.config/nvim.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "===================================="
echo "Neovim Setup — macOS"
echo "===================================="
if [[ "$OSTYPE" != "darwin"* ]]; then
echo "This script is macOS-only."
exit 1
fi
# Homebrew
if ! command -v brew &> /dev/null; then
echo -e "\n[1/6] Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ -x /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -x /usr/local/bin/brew ]]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
else
echo -e "\n[1/6] Homebrew already installed."
fi
# Xcode CLT
echo -e "\n[2/6] Ensuring Xcode command line tools..."
xcode-select --install 2> /dev/null || echo "Xcode CLT already present."
# Core packages
echo -e "\n[3/6] Installing core packages..."
brew install \
neovim \
git \
cmake \
ripgrep \
fd \
node \
python \
tree-sitter-cli \
lua-language-server
# Python LSP server (pylsp)
echo -e "\n[4/6] Installing python-lsp-server..."
python3 -m pip install --user --break-system-packages python-lsp-server 2>/dev/null \
|| python3 -m pip install --user python-lsp-server
# Packer.nvim
echo -e "\n[5/6] Installing packer.nvim..."
PACKER_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/nvim/site/pack/packer/start/packer.nvim"
if [[ ! -d "$PACKER_PATH" ]]; then
git clone --depth 1 https://github.com/wbthomason/packer.nvim "$PACKER_PATH"
else
echo "packer.nvim already installed."
fi
# Copy bundled nvim config
echo -e "\n[6/6] Installing nvim config..."
NVIM_SRC="$SCRIPT_DIR/nvim"
NVIM_DEST="$HOME/.config/nvim"
if [[ ! -d "$NVIM_SRC" ]]; then
echo "ERROR: expected config at $NVIM_SRC — is the nvim/ folder next to this script?"
exit 1
fi
if [[ -d "$NVIM_DEST" ]]; then
BACKUP="$NVIM_DEST.bak.$(date +%Y%m%d_%H%M%S)"
echo "Existing $NVIM_DEST found — backing up to $BACKUP"
mv "$NVIM_DEST" "$BACKUP"
fi
mkdir -p "$NVIM_DEST"
cp -r "$NVIM_SRC"/. "$NVIM_DEST"/
echo "Config installed to $NVIM_DEST"
# PATH hint for pylsp
USER_BIN="$(python3 -m site --user-base)/bin"
if ! echo "$PATH" | grep -q "$USER_BIN"; then
echo -e "\nAdd this to your shell rc so pylsp is on PATH:"
echo " export PATH=\"$USER_BIN:\$PATH\""
fi
cat <<'EOF'
====================================
Installation complete.
====================================
Next steps:
1. Open nvim
2. :PackerInstall (first run — TSUpdate hook may warn; expected)
3. :qa and reopen
4. :PackerSync (now TSUpdate resolves)
5. :TSInstall <lang> for any extra parsers
EOF