-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·94 lines (71 loc) · 2.04 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·94 lines (71 loc) · 2.04 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
#!/bin/bash
# nvim-config - NeoVim config
#
# Copyright (C) 2016-2026 offa
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
RC_DIR=${HOME}
NVIM_CONF_DIR=${RC_DIR}/.config/nvim
PLUG_VIM_REPO=https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
ok() {
echo -e "\e[0;32m[ OK ]\e[0m\t$1"
}
fail() {
echo -e "\e[0;31m[FAIL]\e[0m\t$1"
exit 1
}
info() {
echo -e "[INFO]\t$1"
}
backupIfExisting() {
if [ -e "$1" ] && [ ! -L "$1" ]; then
info "'$1' already exists - creating backup"
mv "$1" "$1.backup"
fi
}
createLink() {
ln -s -f "$1" "$2" || fail "Unable to create link $1 --> $2"
}
linkConfig() {
createLink "$PWD/$1" "${NVIM_CONF_DIR}/$1"
}
installPluginManager() {
curl -sfLo "${NVIM_CONF_DIR}/autoload/plug.vim" --create-dirs "${PLUG_VIM_REPO}" || fail "Downloading Plugin manager failed"
}
checkProgram() {
if command -v "$1" > /dev/null 2>&1; then
ok "$1 found"
else
fail "$1 not found"
fi
}
info "Installation of nvim config"
# Check required applications
checkProgram nvim
checkProgram curl
# Ensure config directory
mkdir -p "${NVIM_CONF_DIR}"
# Create backup of files if already existing
backupIfExisting "${NVIM_CONF_DIR}/init.lua"
# Create links
linkConfig init.lua
linkConfig ftdetect
ok "Links created"
# Install Plugin Manager
installPluginManager
ok "Plugin manager downloaded"
# Install Plugins
nvim +PlugUpgrade +PlugInstall +qa!
ok "Plugins installed"
info "Done"