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