-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL.sh
executable file
·122 lines (99 loc) · 3.41 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
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
#!/bin/bash
###
# RUN THIS WITH /bin/bash NOT /bin/sh
# /bin/sh MAPS TO INCOMPATIBLE TERM EMULATORS
# IN SOME OS
#
# ```
# $ /bin/bash INSTALL.sh
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
### Check for make
if ! [ -x "$(which make)" ]; then
echo "ERROR: You must install \"make\" prior to installing."
exit 1
fi
### Check for gcc
if ! [ -x "$(which gcc)" ]; then
echo "ERROR: You must install \"gcc\" prior to installing."
exit 1
fi
### Check for curl
if ! [ -x "$(which curl)" ]; then
echo "ERROR: You must install \"curl\" prior to installing."
exit 1
fi
### Check for node
if ! [ -x "$(which node)" ]; then
echo "ERROR: You must install \"nodejs\" prior to installing due to coc-vim."
# echo "Attempting to install nodejs via nvm..."
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
exit 1
fi
# create nvim config directory they doesn't exist
mkdir -p $HOME/.config/nvim
SYMLINKS=()
SYMLINKS+=("$DIR $HOME/.vim")
if [[ "$DIR" != "$HOME/.vim" ]]; then
for i in "${SYMLINKS[@]}"; do
# split each command at the space to get config path
IFS=" " read -ra OUT <<< "$i"
echo "SYMLINKING: ln -s ${i}"
if [ ! -d "${OUT[1]}" ] && [ ! -L "${OUT[1]}" ]; then
ln -s $i
elif [ "$(readlink -- "${OUT[1]}")" != "${OUT[0]}" ]; then
mv "${OUT[1]}" "${OUT[1]}.saved"
ln -s $i
fi
done
fi
### Configure Vim-Airline for Linux terminal
# Install Powerline Fonts
#git clone http://www.github.com/tecfu/fonts
#$DIR/fonts/install.sh # not working in ubuntu 20
# declare array
SYMLINKS=()
SYMLINKS+=("$DIR/.vimrc $HOME/.vimrc")
SYMLINKS+=("$DIR/init.vim $HOME/.config/nvim/init.vim")
SYMLINKS+=("$DIR/coc-settings.json $HOME/.config/nvim/coc-settings.json")
SYMLINKS+=("$DIR/efm-langserver-config.yaml $HOME/.config/efm-langserver/config.yaml")
for i in "${SYMLINKS[@]}"; do
#echo $i
# split each command at the space to get config path
IFS=' ' read -ra OUT <<< "$i"
# ${OUT[1]} is path config file should be at
#no config, create symlink to one
if [ ! -f "${OUT[1]}" ] && [ ! -d "${OUT[1]}" ] && [ ! -L "${OUT[1]}" ]; then
echo "SYMLINKING: ln -s $i"
ln -s $i
#config exsts; save if doesn't point to correct target
elif [ "$(readlink -- "${OUT[1]}")" != "${OUT[0]}" ]; then
echo "MV EXISTING: ${OUT[1]} to ${OUT[1]}.saved"
mv "${OUT[1]}" "${OUT[1]}.saved"
echo "SYMLINKING: ln -s $i"
ln -s $i
else
echo "ALREADY SYMLINKED: $i"
fi
done
##### Disable capturing of Ctrl-S, Ctrl-Q in terminal mode:
#OBJECTIVE="Allow ctrl-s, ctrl-q in Vim"
#TARGETFILE1=$HOME"/.bashrc"
#SEARCHSTRING1="stty -ixon > /dev/null 2>/dev/null"
#if ! grep -Fxq "$SEARCHSTRING1" $TARGETFILE1;
#then
# #append code
# echo $SEARCHSTRING1 >> $TARGETFILE1
#fi
echo "INFO: Download vim-plug package manager to ~/.vim/autoload/plug.vim"
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +PlugInstall +qall
WARN_MESSAGES=()
WARN_MESSAGES+=("WARN: FOR VIM BE SURE TO INSTALL POWERLINE FONTS: sudo apt-get install fonts-powerline")
#WARN_MESSAGES+=("WARN: FOR VIM BE SURE TO RUN :PlugInstall")
for MESSAGE in "${WARN_MESSAGES[@]}"; do
echo -e "\033[0;33m$MESSAGE\033[0m"
done