-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
42 lines (38 loc) · 1.18 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
#!/bin/bash
# Create Date: 2017-05-17 11:24:39
# Last Modified: 2018-10-18 18:20:11
DownloadURL='https://github.com/olonglongo/simple-vim/archive/main.tar.gz'
cd /tmp
if command -v wget > /dev/null 2>&1; then
wget --no-check-certificate -O simple-vim.tar.gz -c $DownloadURL
elif command -v curl > /dev/null 2>&1; then
curl -k -L -e '; auto' -o simple-vim.tar.gz $DownloadURL
else
echo "[-] Download file failed, please install wget or curl command." >&2
fi
if [ -f simple-vim.tar.gz ]; then
test -d simple-vim-main && rm -rf simple-vim-main
echo "[+] Extracting files..." >&2
if gzip -dc simple-vim.tar.gz | tar -xf -; then
mv simple-vim-main simple-vim
rm -f simple-vim.tar.gz
else
echo "[-] Extract file failed." >&2
exit 2
fi
else
echo "[-] Download failed." >&2
exit 2
fi
if [ -d $HOME/.vim ]; then
echo "[+] Backup $HOME/.vim to $HOME/.vim_bak" >&2
mv $HOME/.vim{,_bak}
fi
if [ -f $HOME/.vimrc ]; then
echo "[+] Backup $HOME/.vimrc to $HOME/.vimrc_bak" >&2
mv $HOME/.vimrc{,_bak}
fi
cp -r simple-vim/vim $HOME/.vim
cp simple-vim/vimrc $HOME/.vimrc
rm -rf simple-vim
echo "[+] Install simple vim successfully." >&2