blob: abb35b99182eeab4595ad22bbb60aa50e322b540 (
plain)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
#!/bin/sh
#Set Variable to master is not set differently
LVBRANCH="${LVBRANCH:-master}"
set -o nounset # error when referencing undefined variable
set -o errexit # exit when command fails
installnodemac() {
brew install lua
brew install node
brew install yarn
}
installnodeubuntu() {
sudo apt install nodejs
sudo apt install npm
}
moveoldlvim() {
echo "Not installing LunarVim"
echo "Please move your ~/.local/share/lunarvim folder before installing"
exit
}
installnodearch() {
sudo pacman -S nodejs
sudo pacman -S npm
}
installnodefedora() {
sudo dnf install -y nodejs
sudo dnf install -y npm
}
installnodegentoo() {
echo "Printing current node status..."
emerge -pqv net-libs/nodejs
echo "Make sure the npm USE flag is enabled for net-libs/nodejs"
echo "If it isn't enabled, would you like to enable it with flaggie? (Y/N)"
read -r answer
[ "$answer" != "${answer#[Yy]}" ] && sudo flaggie net-libs/nodejs +npm
sudo emerge -avnN net-libs/nodejs
}
installnode() {
echo "Installing node..."
[ "$(uname)" = "Darwin" ] && installnodemac
grep -q Ubuntu /etc/os-release && installnodeubuntu
[ -f "/etc/arch-release" ] && installnodearch
[ -f "/etc/artix-release" ] && installnodearch
[ -f "/etc/fedora-release" ] && installnodefedora
[ -f "/etc/gentoo-release" ] && installnodegentoo
[ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported"
sudo npm i -g neovim
}
installpiponmac() {
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
rm get-pip.py
}
installpiponubuntu() {
sudo apt install python3-pip >/dev/null
}
installpiponarch() {
sudo pacman -S python-pip
}
installpiponfedora() {
sudo dnf install -y pip >/dev/null
}
installpipongentoo() {
sudo emerge -avn dev-python/pip
}
installpip() {
echo "Installing pip..."
[ "$(uname)" = "Darwin" ] && installpiponmac
grep -q Ubuntu /etc/os-release && installpiponubuntu
[ -f "/etc/arch-release" ] && installpiponarch
[ -f "/etc/fedora-release" ] && installpiponfedora
[ -f "/etc/gentoo-release" ] && installpipongentoo
[ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported"
}
installpynvim() {
echo "Installing pynvim..."
if [ -f "/etc/gentoo-release" ]; then
echo "Installing using Portage"
sudo emerge -avn dev-python/pynvim
else
pip3 install pynvim --user
fi
}
installpacker() {
git clone https://github.com/wbthomason/packer.nvim ~/.local/share/lunarvim/site/pack/packer/start/packer.nvim
}
cloneconfig() {
echo "Cloning LunarVim configuration"
mkdir -p ~/.local/share/lunarvim
case "$@" in
*--testing*)
cp -r "$(pwd)" ~/.local/share/lunarvim/lvim
;;
*)
git clone --branch "$LVBRANCH" https://github.com/ChristianChiarulli/lunarvim.git ~/.local/share/lunarvim/lvim
;;
esac
mkdir -p "$HOME/.config/lvim"
sudo cp "$HOME/.local/share/lunarvim/lvim/utils/bin/lvim" "/usr/local/bin"
sudo chmod a+rx /usr/local/bin/lvim
cp "$HOME/.local/share/lunarvim/lvim/utils/installer/lv-config.example-no-ts.lua" "$HOME/.config/lvim/lv-config.lua"
nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" --headless \
+'autocmd User PackerComplete sleep 100m | qall' \
+PackerInstall
nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" --headless \
+'autocmd User PackerComplete sleep 100m | qall' \
+PackerSync
printf "\nCompile Complete\n"
if [ -e "$HOME/.local/share/lunarvim/lvim/init.lua" ]; then
echo 'lv-config already present'
else
cp "$HOME/.local/share/lunarvim/lvim/utils/installer/lv-config.example.lua" "$HOME/.config/lvim/lv-config.lua"
fi
}
asktoinstallnode() {
echo "node not found"
printf "Would you like to install node now (y/n)? "
read -r answer
[ "$answer" != "${answer#[Yy]}" ] && installnode
}
asktoinstallpip() {
# echo "pip not found"
# echo -n "Would you like to install pip now (y/n)? "
# read answer
# [ "$answer" != "${answer#[Yy]}" ] && installpip
echo "Please install pip3 before continuing with install"
exit
}
installonmac() {
brew install ripgrep fzf
npm install -g tree-sitter-cli
}
installonubuntu() {
sudo apt install ripgrep fzf
sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
pip3 install neovim-remote
npm install -g tree-sitter-cli
}
installonarch() {
sudo pacman -S ripgrep fzf
pip3 install neovim-remote
npm install -g tree-sitter-cli
}
installonfedora() {
sudo dnf groupinstall "X Software Development"
sudo dnf install -y fzf ripgrep
}
installongentoo() {
sudo emerge -avn sys-apps/ripgrep app-shells/fzf dev-python/neovim-remote virtual/jpeg sys-libs/zlib
npm install -g tree-sitter-cli
}
installextrapackages() {
[ "$(uname)" = "Darwin" ] && installonmac
grep -q Ubuntu /etc/os-release && installonubuntu
[ -f "/etc/arch-release" ] && installonarch
[ -f "/etc/artix-release" ] && installonarch
[ -f "/etc/fedora-release" ] && installonfedora
[ -f "/etc/gentoo-release" ] && installongentoo
[ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported"
}
# Welcome
echo 'Installing LunarVim'
case "$@" in
*--overwrite*)
echo '!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag'
rm -rf "$HOME/.local/share/lunarvim"
rm -rf "$HOME/.cache/nvim"
rm -rf "$HOME/.config/lvim"
;;
esac
# move old lvim directory if it exists
[ -d "$HOME/.local/share/lunarvim" ] && moveoldlvim
# install pip
(command -v pip3 >/dev/null && echo "pip installed, moving on...") || asktoinstallpip
# install node and neovim support
(command -v node >/dev/null && echo "node installed, moving on...") || asktoinstallnode
# install pynvim
(pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on...") || installpynvim
if [ -e "$HOME/.local/share/lunarvim/site/pack/packer/start/packer.nvim" ]; then
echo 'packer already installed'
else
installpacker
fi
if [ -e "$HOME/.local/share/lunarvim/lvim/init.lua" ]; then
echo 'LunarVim already installed'
else
# clone config down
cloneconfig "$@"
# echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc
# echo 'export PATH=$HOME/.config/lunarvim/utils/bin:$PATH' >>~/.bashrc
fi
if [ "$(uname)" != "Darwin" ]; then
if [ -e "$HOME/.local/share/applications/lvim.desktop" ]; then
echo 'Desktop file already available'
else
mkdir -p "$HOME/.local/share/applications"
cp "$HOME/.local/share/lunarvim/lvim/utils/desktop/lvim.desktop" "$HOME/.local/share/applications/lvim.desktop"
fi
fi
echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
# echo 'export PATH=/home/$USER/.config/lunarvim/utils/bin:$PATH appending to zshrc/bashrc'
|