Handle older Vims that don't have native package support by falling back on junegunn/vim-plug

This commit is contained in:
Danielle McLean 2018-02-13 17:02:08 +11:00
parent 0a105241d5
commit 1b532523c5
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
2 changed files with 88 additions and 54 deletions

View file

@ -7,6 +7,7 @@ function! s:ensure_dir(dir)
endif endif
endfunction endfunction
if exists('+packpath')
" These are really clever - minpac will actually be loaded on the fly only " These are really clever - minpac will actually be loaded on the fly only
" when you need to update or clean your packages, rather than all the time. " when you need to update or clean your packages, rather than all the time.
command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | call minpac#update() command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | call minpac#update()
@ -17,6 +18,11 @@ command! PackClean source $XDG_CONFIG_HOME/vim/plugins.vim | call minpac#clean(
if !isdirectory($XDG_CACHE_HOME . '/vim/pack') if !isdirectory($XDG_CACHE_HOME . '/vim/pack')
PackUpdate PackUpdate
endif endif
else
" If we're on a version of Vim that doesn't have packages, we have to load a
" plugin manager (vim-plug) on every boot.
source $XDG_CONFIG_HOME/vim/plugins.vim
endif
augroup transparent_term augroup transparent_term
autocmd! autocmd!
@ -31,7 +37,7 @@ let g:gruvbox_improved_warnings=1
" transparent background colours. It works totally fine in Neovim though. " transparent background colours. It works totally fine in Neovim though.
if has('gui_running') || has('nvim') if has('gui_running') || has('nvim')
set termguicolors set termguicolors
packadd gruvbox silent! packadd gruvbox
let g:airline_theme = 'gruvbox' let g:airline_theme = 'gruvbox'
colorscheme gruvbox colorscheme gruvbox
else else

View file

@ -1,3 +1,4 @@
if exists('+packpath')
silent! packadd minpac silent! packadd minpac
if !exists('*minpac#init') if !exists('*minpac#init')
silent !git clone https://github.com/k-takata/minpac.git $XDG_CACHE_HOME/vim/pack/minpac/opt/minpac silent !git clone https://github.com/k-takata/minpac.git $XDG_CACHE_HOME/vim/pack/minpac/opt/minpac
@ -7,49 +8,76 @@ if !exists('*minpac#init')
augroup END augroup END
endif endif
function! Plug(...)
call call('minpac#add', a:000)
endfunction
function! PlugEnd()
endfunction
packadd minpac packadd minpac
call minpac#init({'dir': $XDG_CACHE_HOME . '/vim'}) call minpac#init({'dir': $XDG_CACHE_HOME . '/vim'})
call minpac#add('k-takata/minpac', {'type': 'opt'}) else
call minpac#add('tpope/vim-sensible') if !filereadable($XDG_CACHE_HOME . '/vim/autoload/plug.vim')
silent !curl -fLo $XDG_CACHE_HOME/vim/autoload/plug.vim --create-dirs 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
augroup vimplug
autocmd VimEnter * PlugInstall
augroup END
endif
call minpac#add('ciaranm/inkpot', {'type': 'opt', 'do': 'colorscheme inkpot'}) function! Plug(name, ...)
call minpac#add('morhetz/gruvbox', {'type': 'opt'}) call plug#(name)
endfunction
call minpac#add('editorconfig/editorconfig-vim') function! PlugEnd()
call minpac#add('jamessan/vim-gnupg') call plug#end()
call minpac#add('junegunn/fzf') endfunction
call minpac#add('junegunn/fzf.vim')
call minpac#add('junegunn/vim-easy-align')
call minpac#add('lifepillar/vim-mucomplete')
call minpac#add('mhinz/vim-signify')
call minpac#add('scrooloose/nerdtree')
call minpac#add('sjl/vitality.vim')
call minpac#add('tpope/vim-commentary')
call minpac#add('tpope/vim-endwise')
call minpac#add('tpope/vim-fugitive')
call minpac#add('tpope/vim-repeat')
call minpac#add('tpope/vim-rhubarb')
call minpac#add('tpope/vim-sleuth')
call minpac#add('tpope/vim-surround')
call minpac#add('tpope/vim-unimpaired')
call minpac#add('vim-airline/vim-airline')
call minpac#add('vim-airline/vim-airline-themes')
call minpac#add('wincent/loupe')
call minpac#add('wincent/terminus')
call minpac#add('w0rp/ale')
call minpac#add('LaTeX-Box-Team/LaTeX-Box') call plug#begin($XDG_CACHE_HOME . '/vim/plugged')
call minpac#add('vhda/verilog_systemverilog.vim') endif
call minpac#add('sheerun/vim-polyglot')
call minpac#add('sukima/xmledit')
call minpac#add('lepture/vim-jinja') call Plug('k-takata/minpac', {'type': 'opt'})
call Plug('tpope/vim-sensible')
call minpac#add('alx741/yesod.vim') call Plug('ciaranm/inkpot', {'type': 'opt', 'do': 'colorscheme inkpot'})
call minpac#add('pbrisbin/vim-syntax-shakespeare') call Plug('morhetz/gruvbox', {'type': 'opt'})
call Plug('editorconfig/editorconfig-vim')
call Plug('jamessan/vim-gnupg')
call Plug('junegunn/fzf')
call Plug('junegunn/fzf.vim')
call Plug('junegunn/vim-easy-align')
call Plug('lifepillar/vim-mucomplete')
call Plug('mhinz/vim-signify')
call Plug('scrooloose/nerdtree')
call Plug('sjl/vitality.vim')
call Plug('tpope/vim-commentary')
call Plug('tpope/vim-endwise')
call Plug('tpope/vim-fugitive')
call Plug('tpope/vim-repeat')
call Plug('tpope/vim-rhubarb')
call Plug('tpope/vim-sleuth')
call Plug('tpope/vim-surround')
call Plug('tpope/vim-unimpaired')
call Plug('vim-airline/vim-airline')
call Plug('vim-airline/vim-airline-themes')
call Plug('wincent/loupe')
call Plug('wincent/terminus')
call Plug('w0rp/ale')
call Plug('LaTeX-Box-Team/LaTeX-Box')
call Plug('vhda/verilog_systemverilog.vim')
call Plug('sheerun/vim-polyglot')
call Plug('sukima/xmledit')
call Plug('lepture/vim-jinja')
call Plug('alx741/yesod.vim')
call Plug('pbrisbin/vim-syntax-shakespeare')
if has('macunix') if has('macunix')
call minpac#add('itspriddle/vim-marked') call Plug('itspriddle/vim-marked')
endif endif
call PlugEnd()