bugfix(_example): vars should be quoted (and disable unexported vars warning)
[webi-installers/.git] / vim-rust / install.sh
1 #!/bin/bash
2
3 function __init_vim_rust() {
4     set -e
5     set -u
6
7     mkdir -p "$HOME/.vim/pack/plugins/start"
8     rm -rf "$HOME/.vim/pack/plugins/start/rust.vim"
9     git clone --depth=1 https://github.com/rust-lang/rust.vim "$HOME/.vim/pack/plugins/start/rust.vim"
10
11     if [ -f "$HOME/.vimrc" ]; then
12         set +e
13         if ! grep 'source.*rust.vim' -r ~/.vimrc; then
14             mkdir -p ~/.vim/plugins
15             printf '\n" Rust: reasonable defaults from webinstall.dev/vim-rust\n' >> ~/.vimrc
16             printf 'source ~/.vim/plugins/rust.vim\n' >> ~/.vimrc
17         fi
18         set -e
19     fi
20
21     if ! [ -f "$HOME/.vim/plugins/rust.vim" ]; then
22         mkdir -p ~/.vim/plugins
23         WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
24         curl -fsS -o ~/.vim/plugins/rust.vim "$WEBI_HOST/packages/vim-rust/rust.vim"
25     fi
26 }
27
28 __init_vim_rust