-
Notifications
You must be signed in to change notification settings - Fork 2
/
flo-neovim-install.sh
executable file
Β·405 lines (375 loc) Β· 15.1 KB
/
flo-neovim-install.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
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
#!/bin/sh
# In this script, I use `printf` instead of `echo` to have a better compatibility w/ all shell.
set -e pipefail
Os="$(uname -s)"
if [ ! "$Os" = "Linux" ]; then
printf "\n"
printf " ================================================\n"
printf " \n"
printf " I am sorry ... \n"
printf " \n"
printf " Windows and Mac OS are currently not supported !\n"
printf " \n"
printf " ================================================\n"
exit 1
fi
if ! which node > /dev/null; then
printf "\n"
printf " ================================================\n"
printf " \n"
printf " I am sorry ... \n"
printf " \n"
printf " You need to install node.js first ! \n"
printf " \n"
printf " ================================================\n"
exit 1
fi
printf "\n"
printf " =========================================\n"
printf " \n"
printf " Welcome to Flo-neovim installer ! \n"
printf " \n"
printf " =========================================\n"
while true; do
printf "\n"
printf " Please set your folder name.\n"
printf " e.g.: 'Flo' will create ~/Flo\n"
printf "\n"
printf " Folder name: "
read FolderName
if [ "$FolderName" = "" ]; then
printf "\n"
printf " You need to enter a folder name !\n"
continue
fi
printf "\n"
printf " It will create three folders: ~/%s, ~/%s/Apps and ~/%s/Dotfiles\n" "$FolderName" "$FolderName" "$FolderName"
printf " to get the following folder tree\n\n"
printf " /home\n"
printf " β\n"
printf " ββ %s\n" "$USER"
printf " β\n"
printf " ββ %s\n" "$FolderName"
printf " β\n"
printf " ββ Apps\n"
printf " β β\n"
printf " β ββ Neovim install folder\n"
printf " β\n"
printf " ββ Dotfiles\n"
printf " β\n"
printf " ββ Neovim config\n"
printf "\n"
printf " Continue with '%s' as folder name ?\n" "$FolderName"
printf "\n"
printf " [y]es, [n]o or [q]uit: "
read ChoiceFolderName
case "$ChoiceFolderName" in
y|yes|Y|YES|YEs|YeS|yeS|yES)
break
;;
n|N|no|NO|No|nO)
continue
;;
*)
printf "\n"
printf " ================================================\n"
printf " \n"
printf " Nothing has been created or installed. \n"
printf " \n"
printf " See you soon :) \n"
printf " \n"
printf " ================================================\n"
exit 1
;;
esac
done
while true; do
printf "\n"
printf " Please set your neovim username.\n"
printf " e.g.: 'FloSlv' will create ~/$FolderName/Dotfiles/Neovim/lua/FloSlv\n"
printf "\n"
printf " Neovim username: "
read NeovimUsername
if [ "$NeovimUsername" = "" ]; then
printf "\n"
printf " You need to enter an username to set the neovim config !\n"
continue
fi
printf "\n"
printf " It will create the following folder: ~/%s/Dotfiles/Neovim/lua/%s\n" "$FolderName" "$NeovimUsername"
printf " to get the following folder tree\n\n"
printf " /home\n"
printf " β\n"
printf " ββ %s\n" "$USER"
printf " β\n"
printf " ββ %s\n" "$FolderName"
printf " β\n"
printf " ββ Apps\n"
printf " β β\n"
printf " β ββ Neovim install folder\n"
printf " β\n"
printf " ββ Dotfiles\n"
printf " β\n"
printf " ββ neovim\n"
printf " β\n"
printf " ββ lua\n"
printf " β β\n"
printf " β ββ %s\n" "$NeovimUsername"
printf " β β\n"
printf " β ββ undodir/\n"
printf " β ββ keymaps.lua\n"
printf " β ββ options.lua\n"
printf " β ββ packer.lua\n"
printf " β ββ utils.lua\n"
printf " β\n"
printf " ββ after\n"
printf " β\n"
printf " ββ plugin\n"
printf " β\n"
printf " ββ plugin config file\n"
printf " ββ plugin config file\n"
printf " ββ ...\n"
printf " β\n"
printf " ββ ftplugin\n"
printf "\n"
printf " Continue with '%s' as neovim username ?\n" "$NeovimUsername"
printf " [y]es, [n]o or [q]uit: "
read ChoiceNeovimUsername
case "$ChoiceNeovimUsername" in
y|yes|Y|YES|YEs|YeS|yeS|yES)
break
;;
n|N|no|NO|No|nO)
continue
;;
*)
printf "\n"
printf " ================================================\n"
printf " \n"
printf " Nothing has been created or installed. \n"
printf " \n"
printf " See you soon :) \n"
printf " \n"
printf " ================================================\n"
exit 1
;;
esac
done
echo "\n"
BaseFolder="$HOME/$FolderName"
Apps="$HOME/$FolderName/Apps"
Dotfiles="$HOME/$FolderName/Dotfiles"
Neovim="$HOME/$FolderName/Dotfiles/neovim"
Lua="$HOME/$FolderName/Dotfiles/neovim/lua"
NeovimUserFolder="$HOME/$FolderName/Dotfiles/neovim/lua/$NeovimUsername"
Undodir="$HOME/$FolderName/Dotfiles/neovim/lua/$NeovimUsername/undodir"
After="$HOME/$FolderName/Dotfiles/neovim/after"
AfterPlugin="$HOME/$FolderName/Dotfiles/neovim/after/plugin"
AfterFtPlugin="$HOME/$FolderName/Dotfiles/neovim/after/ftplugin"
Plugin="$HOME/$FolderName/Dotfiles/neovim/plugin"
printf "====================================\n"
printf " Removing existing Neovim \n"
printf " - installation files \n"
printf " - config files \n"
printf "====================================\n"
rm -rf $HOME/.config/nvim
rm -rf $HOME/.local/share/nvim
rm -rf $Apps/Neovim
rm -rf $Dotfiles/neovim
if [ ! -d "$Apps" ]; then
mkdir -p $Apps
printf "=== %s created ! ===\n" "$Apps"
fi
if [ ! -d "$Dotfiles" ]; then
mkdir -p $Dotfiles
printf "=== %s created ! ===\n" "$Dotfiles"
fi
if [ ! -d "$Neovim" ]; then
mkdir -p $Neovim
printf "=== %s created ! ===\n" "$Neovim"
printf "\n"
mkdir $Lua
printf "=== %s created ! ===\n" "$Lua"
printf "\n"
mkdir $NeovimUserFolder
printf "=== %s created ! ===\n" "$NeovimUserFolder"
printf "\n"
mkdir $Undodir
printf "=== %s created ! ===\n" "$Undodir"
printf "\n"
mkdir $After
printf "=== %s created ! ===\n" "$After"
printf "\n"
mkdir $AfterPlugin
printf "=== %s created ! ===\n" "$AfterPlugin"
mkdir $AfterFtPlugin
printf "=== %s created ! ===\n" "$AfterFtPlugin"
mkdir $Plugin
printf "=== %s created ! ===\n" "$Plugin"
fi
printf "\n"
printf "=== apt update ===\n"
printf "\n"
cd ~
sudo apt update
printf "=== apt upgrade ===\n"
printf "\n"
sudo apt upgrade -y
# Neovim install
printf "\n"
printf "=========================\n"
printf " INSTALLING NEOVIM \n"
printf "=========================\n"
printf "\n"
printf "=== install dependencies ===\n"
printf "\n"
sudo apt install -y ninja-build gettext libtool libtool-bin autoconf automake \
cmake g++ pkg-config doxygen zoxide python3-pip mlocate libsqlite3-dev python3-dev \
libssl-dev ripgrep fd-find silversearcher-ag bat libicu-dev libboost-all-dev
sudo apt autoremove -y
printf "\n"
printf "=== git clone nvim-release-0.8 ===\n"
printf "\n"
cd $Apps
git clone -b release-0.8 https://github.com/neovim/neovim Neovim
cd Neovim
printf "=== make ===\n"
printf "\n"
make CMAKE_BUILD_TYPE=RelWithDebInfo
printf "\n"
printf "=== make install ===\n"
printf "\n"
sudo make install
printf "\n"
printf "==========================\n"
printf " NEOVIM INSTALLED ! \n"
printf "==========================\n"
printf "\n"
# Pynvim
printf "\n"
printf "=========================\n"
printf " INSTALLING PYNVIM \n"
printf "=========================\n"
printf "\n"
cd ~
pip3 install pynvim
printf "\n"
printf "==========================\n"
printf " PYNVIM INSTALLED ! \n"
printf "==========================\n"
printf "\n"
# Packer
printf "\n"
printf "=========================\n"
printf " INSTALLING PACKER \n"
printf "=========================\n"
printf "\n"
rm -rf ~/.local/share/nvim
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
printf "\n"
printf "==========================\n"
printf " PACKER INSTALLED ! \n"
printf "==========================\n"
printf "\n"
# Tree-sitter-cli (node.js)
printf "\n"
printf "=================================\n"
printf " INSTALLING TREE-SITER-CLI \n"
printf " node.js \n"
printf "=================================\n"
printf "\n"
cd ~
npm i -g tree-sitter-cli
printf "\n"
printf "==================================\n"
printf " TREE-SITER-CLI INSTALLED ! \n"
printf "==================================\n"
printf "\n"
# Neovim-cli (node.js)
printf "\n"
printf "=============================\n"
printf " INSTALLING NEOVIM-CLI \n"
printf " node.js \n"
printf "=============================\n"
printf "\n"
cd ~
npm i -g neovim
printf "\n"
printf "==============================\n"
printf " NEOVIM-CLI INSTALLED ! \n"
printf "==============================\n"
printf "\n"
# Neovim config
printf "\n"
printf "=====================\n"
printf " NEOVIM CONFIG \n"
printf "=====================\n"
printf "\n"
printf "=== install config files ===\n"
printf "\n"
wget -P $NeovimUserFolder https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/lua/FloSlv/options.lua
wget -P $NeovimUserFolder https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/lua/FloSlv/keymaps.lua
wget -P $NeovimUserFolder https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/lua/FloSlv/utils.lua
wget -P $NeovimUserFolder https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/lua/FloSlv/packer.lua
wget -P $Neovim https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/init.lua
# Next two are not required: autorun and autosave
wget -P $NeovimUserFolder https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/lua/FloSlv/autorun.lua
wget -P $NeovimUserFolder https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/lua/FloSlv/autosave.lua
printf "\n"
printf "=== install plugins config file ===\n"
printf "\n"
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/autopairs.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/colorscheme.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/colorful-winsep.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/comment.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/dashboard.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/gitsigns.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/glow.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/indent-blankline.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/lsp.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/lualine.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/luasnip.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/null-ls.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-autopairs.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-bqf.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-cmp.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-colorizer.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-notify.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-tree.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-treesitter.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/nvim-web-devicons.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/rust-tools.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/tailwindcss-colorizer-cmp.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/telescope.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/todo-comments.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/trouble.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/undotree.lua # Be careful with undotree, because I hardcode path inside this file !
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/vim-dadbod-ui.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/vim-illuminate.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/vimade.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/which-key.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/wilder.lua
wget -P $AfterPlugin https://raw.githubusercontent.com/Flo-Slv/Dotfiles/main/neovim/after/plugin/winbar.lua
printf "\n"
printf "===============================\n"
printf " NEOVIM CONFIG INSTALLED \n"
printf "===============================\n"
# Stow
printf "\n"
printf "========================================\n"
printf " SYMBOLIC LINKS TO ~/.config/nvim \n"
printf "========================================\n"
printf "\n"
cd $HOME/.config
mkdir nvim
cd $Dotfiles
stow -t $HOME/.config/nvim neovim
printf "\n"
printf "=============================\n"
printf " SYMBOLIC LINKS DONE ! \n"
printf "=============================\n"
# Neovim version
printf "\n"
printf "=== neovim version ===\n"
printf "\n"
nvim --version