plugins: Change easychair2 url
[vimconf.git] / install.sh
1 #!/bin/sh
2
3 set -e
4
5 check_vim()
6 {
7 if /usr/bin/vim --version | grep -q "NVIM"; then
8 return
9 fi
10
11 if /usr/bin/vim --version | grep -q "$1"; then
12 echo "vim has support for $1."
13 else
14 echo "vim has no support for $1. Aborting."
15 exit
16 fi
17 }
18
19 check_py3()
20 {
21 if python3 -c "import $1" 2>/dev/null; then
22 echo "Python3 module '$1' exists."
23 else
24 echo "Python3 module '$1' missing. Aborting."
25 exit
26 fi
27 }
28
29 check_prog()
30 {
31 if which "$1" > /dev/null; then
32 echo "$1 found."
33 else
34 echo "$1 not found. Aborting."
35 exit
36 fi
37 }
38
39 check_font()
40 {
41 if fc-list | grep -q "$1"; then
42 echo "Font $1 found."
43 else
44 echo "Font $1 not found. Either install it or clear g:enable_plugin_devicons."
45 fi
46 }
47
48 check_requirements()
49 {
50 check_prog aspell
51 check_prog curl
52 check_prog git
53 check_vim +python3
54 check_py3 neovim
55 check_font "Hack NF"
56 }
57
58 backup() {
59 if [ -e $1 ]; then
60 echo " Move $1"
61 mv $1 $2/
62 fi
63 }
64
65 install() {
66 BACKUPDIR=$(mktemp -d "$HOME/.vim-old-XXXXXXXX")
67 echo "Move old vim files to $BACKUPDIR"
68 backup $HOME/.viminfo $BACKUPDIR
69 backup $HOME/.vimrc $BACKUPDIR
70 backup $HOME/.gvimrc $BACKUPDIR
71 backup $HOME/.config/nvim $BACKUPDIR
72
73 echo ""
74 echo "Installing files..."
75 echo "# Empty" > $HOME/.viminfo
76 ln -s $HOME/.vim/init.vim $HOME/.vimrc
77 ln -s $HOME/.vim/gvimrc $HOME/.gvimrc
78 ln -s $HOME/.vim $HOME/.config/nvim
79
80 cat << EOF
81 At the first start the plugins will be installed. Hence, at the first
82 start the plugin provided colorscheme is not available yet.
83
84 Add this line to your shell configuration, e.g., ~/.profile, to
85 use vim as man pager:
86 export MANPAGER=\"view -c MANPAGER -\"
87 EOF
88 }
89
90
91 check_requirements
92 install