From 151e706a36e490dfd8de6956c3b27e0e54f7004a Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 14 Nov 2018 18:23:28 -0500 Subject: [PATCH] vim: Strategically install plugins Instead of failing silently when the wal colorscheme is not found, we can take this as a cue to install the necessary vim plugins instead. --- vim/.vimrc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vim/.vimrc b/vim/.vimrc index 019cef23..2e95672c 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -11,7 +11,6 @@ let plugusr = glob('~/.vim/autoload/plug.vim') if empty(plugsys) && empty(plugusr) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/0.10.0/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif call plug#begin('~/.vim/plugged') @@ -101,8 +100,13 @@ set mouse=a " Enable mouse support in (a)ll modes " ========= colors ========= " ========================== -" Set the color scheme to wal, or fail silently if it's not installed -silent! colorscheme wal +" Set the color scheme to wal, or install plugins as needed. +try + colorscheme wal +catch /^Vim\%((\a\+)\)\=:E185/ + echo "wal was not found. Installing plugins...\n" | PlugInstall --sync + echo "Plugins installed! You can now use vim.\n" | qa +endtry " Don't show the separator for vertical splits highlight vertsplit ctermfg=0 ctermbg=none