From 2fa91642d33b476633d8029daa576f8979adef61 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 31 Oct 2018 12:28:54 -0400 Subject: [PATCH] vim: Install vim-plug if it is not present This commit means that manually copy/pasting the curl command on new machines is no longer necessary. --- vim/.vimrc | 9 +++++++++ vim/README.md | 8 +------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/vim/.vimrc b/vim/.vimrc index 8c8c337..48c75f8 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -5,6 +5,15 @@ if &shell =~# 'fish$' set shell=sh endif +let plugsys = glob('/usr/share/vim/vimfiles/autoload/plug.vim') +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') Plug 'dylanaraps/wal.vim' " Color scheme Plug 'airblade/vim-gitgutter' " Git diff diff --git a/vim/README.md b/vim/README.md index 2b296f4..b22045e 100644 --- a/vim/README.md +++ b/vim/README.md @@ -20,12 +20,6 @@ make package=vim ## Usage -I use [vim-plug][vim-plug] as my plugin manager of choice. Install it, then run: - -``` -vim +PlugInstall +qall -``` - -Now you can use my vim config with all the plugins installed! +I use [vim-plug][vim-plug] as my plugin manager of choice. If it isn't installed already, my `.vimrc` will install it for you. If you already have vim-plug installed, run `:PlugInstall`. Now you can use my vim config with all the plugins enabled! [vim-plug]: https://github.com/junegunn/vim-plug