X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=_vim-example%2Finstall.sh;fp=_vim-example%2Finstall.sh;h=55cd88dac02093aaf9e42def1a367d4cdc298d49;hb=82d7d2d05b6f882e7a6f7d5bd07ab12b06b2c2d2;hp=0000000000000000000000000000000000000000;hpb=34ec1966ab59c42175a357d8de2058fd2d792dba;p=webi-installers%2F.git diff --git a/_vim-example/install.sh b/_vim-example/install.sh new file mode 100644 index 0000000..55cd88d --- /dev/null +++ b/_vim-example/install.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +function __init_vim_example() { + set -e + set -u + + mkdir -p "$HOME/.vim/pack/plugins/start" + rm -rf "$HOME/.vim/pack/plugins/start/example.vim" + git clone --depth=1 https://github.com/CHANGEME/example.git "$HOME/.vim/pack/plugins/start/example" + + if [ ! -f "$HOME/.vimrc" ]; then + touch "$HOME/.vimrc" + fi + + mkdir -p ~/.vim/plugins + if ! [ -f "$HOME/.vim/plugins/example.vim" ]; then + WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} + curl -fsSL -o ~/.vim/plugins/example.vim "$WEBI_HOST/packages/vim-example/example.vim" + fi + + if ! grep 'source.*plugins.example.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + set +e + mkdir -p ~/.vim/plugins + printf '\n" example: reasonable defaults from webinstall.dev/vim-example\n' >> ~/.vimrc + printf 'source ~/.vim/plugins/example.vim\n' >> ~/.vimrc + set -e + echo "" + echo "add ~/.vim/plugins/example.vim" + echo "updated ~/.vimrc with 'source ~/.vim/plugins/example.vim'" + fi + + echo "" + echo "vim-example enabled with reasonable defaults" + +} + +__init_vim_example