-
Notifications
You must be signed in to change notification settings - Fork 0
/
UNINSTALL.sh
executable file
·51 lines (41 loc) · 1.2 KB
/
UNINSTALL.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
#!/bin/bash
###
# RUN THIS WITH /bin/bash NOT /bin/sh
# /bin/sh MAPS TO INCOMPATIBLE TERM EMULATORS
# IN SOME OS
#
# ```
# $ /bin/bash UNINSTALL.sh
#
###
# declare array
SYMLINKS=()
SYMLINKS+=("$DIR/.vim $HOME/.vim")
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/efn-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
#nothing to do
if [ ! -f "${OUT[1]}" ] && [ ! -d "${OUT[1]}" ]; then
echo "CONFIG FILES ALREADY REMOVED"
#restore old configs
elif [ "$(readlink -- "${OUT[1]}")" != "${OUT[0]}" ]; then
echo "REMOVING ${OUT[1]}.saved"
mv "${OUT[1]}.saved" "${OUT[1]}"
fi
done
#### Disable capturing of Ctrl-S, Ctrl-Q in terminal mode:
TARGETFILE1=$HOME"/.bashrc"
SEARCHSTRING1="stty -ixon > /dev/null 2>/dev/null"
if grep -Fxq "$SEARCHSTRING1" $TARGETFILE1
then
#remove code from file
sed -i '/$SEARCHSTRING1/d' $TARGETFILE1
fi
printf "\n"
echo DONE.