Created
October 24, 2017 23:18
-
-
Save ony/efd1de13181f4bcebaf5795a4ee46905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" minautopac.vim | |
" Naïve autoload of packs | |
" See https://github.com/k-takata/minpac/issues/28 | |
" And https://github.com/junegunn/vim-plug/blob/9813d5e/plug.vim#L271-L276 | |
function! minautopac#add(repo, ...) | |
let l:opts = get(a:000, 0, {}) | |
if has_key(l:opts, 'for') | |
let l:name = substitute(a:repo, '^.*/', '', '') | |
let l:ft = l:opts.for " TODO: support array | |
execut printf('autocmd FileType %s packadd %s', l:ft, l:name) | |
endif | |
endfunction | |
if exists('*minpac#init') | |
call minpac#init() | |
command! -nargs=+ -bar Plugin call minpac#add(<args>) | call minautopac#add(<args>) | |
else | |
" do nothing | |
command! -nargs=+ Plugin call minautopac#add(<args>) | |
endif | |
command! -bar PackUpdate packadd minpac | runtime minautopac.vim | call minpac#update() | |
command! -bar PackClean packadd minpac | runtime minautopac.vim | call minpac#clean() | |
runtime! OPT ftdetect/*.vim | |
augroup MinAutoPac | |
autocmd! | |
runtime! myplugins.vim | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment