-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·74 lines (63 loc) · 1.73 KB
/
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
#!/usr/bin/env bash
### Tested on Fedora 37 Workstation
###
### Execute the script as a simple user and NOT as root.
###
## Fail if something went wrong
set -euo pipefail
# Authorize sudo
sudo echo
# Fails if npm is not installed
npm -v
echo
echo -n "Copy dotfiles for neovim ? [y/N] "
read c_answer_neovim
if [[ "$c_answer_neovim" == "y" ]]; then
cp -r config/nvim ~/.config/
fi
c_answer_neovim_dep="y"
if [[ "$c_answer_neovim" != "y" ]]; then
echo
echo -n "Install neovim and its dependencies ? [y/N] "
read c_answer_neovim_dep
fi
if [[ "$c_answer_neovim_dep" == "y" ]]; then
# Package managers
declare -A PACKAGE_INSTALLERS=(
[dnf]="dnf install neovim gcc-c++ go fzf"
[pacman]="pacman -S neovim gcc go fzf"
)
INSTALL_PKG=''
for cmd in "${!PACKAGE_INSTALLERS[@]}"
do
if ! command -v "$cmd" &> /dev/null
then
# echo "$cmd could not be found"
echo
else
# echo "OK, $cmd exists"
INSTALL_PKG="${PACKAGE_INSTALLERS[$cmd]}"
break
fi
done
## Neovim
#
# neovim, gcc-c++, go
#
if [[ -n INSTALL_PKG ]]; then
eval sudo "$INSTALL_PKG"
fi
#
# vim-plug: https://github.com/junegunn/vim-plug
#
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
#
# ascii-image-converter: https://github.com/TheZoraiz/ascii-image-converter
#
go install github.com/TheZoraiz/ascii-image-converter@latest
#
# lsp
#
npm i -g pyright @angular/language-server vscode-langservers-extracted typescript typescript-language-server yaml-language-server
fi