chore(lint): == to ===
[webi-installers/.git] / vim-gui / install.sh
1 #!/bin/bash
2
3 function __init_vim_mouse() {
4     set -e
5     set -u
6
7     mkdir -p "$HOME/.vim/plugins"
8     rm -rf "$HOME/.vim/plugins/mouse.vim"
9
10     echo ""
11
12     if [ ! -e "$HOME/.vimrc" ]; then
13         touch "$HOME/.vimrc"
14     fi
15
16     if ! [ -f "$HOME/.vim/plugins/mouse.vim" ]; then
17         mkdir -p ~/.vim/plugins
18         WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
19         curl -fsS -o ~/.vim/plugins/mouse.vim "$WEBI_HOST/packages/vim-mouse/mouse.vim"
20     fi
21
22     if ! grep 'source.*plugins.mouse.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then
23         set +e
24         mkdir -p ~/.vim/plugins
25         printf '\n" Mouse Support: reasonable defaults from webinstall.dev/vim-mouse\n' >> ~/.vimrc
26         printf 'source ~/.vim/plugins/mouse.vim\n' >> ~/.vimrc
27         set -e
28         echo "added ~/.vim/plugins/mouse.vim"
29         echo "updated ~/.vimrc with 'source ~/.vim/plugins/mouse.vim'"
30         echo ""
31     fi
32
33     echo "vim-mouse enabled with reasonable defaults"
34 }
35
36 __init_vim_mouse