mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-06 17:14:26 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ddee62977 | ||
|
|
8cf5fca9ca | ||
|
|
347fccb030 | ||
|
|
a026eb39c4 | ||
|
|
4d352e1849 | ||
|
|
db3f5ad5c3 |
40
plug.vim
40
plug.vim
@@ -58,7 +58,6 @@ set cpo&vim
|
||||
let s:plug_source = 'https://raw.github.com/junegunn/vim-plug/master/plug.vim'
|
||||
let s:plug_file = 'Plugfile'
|
||||
let s:plug_buf = -1
|
||||
let s:loaded = {}
|
||||
let s:is_win = has('win32') || has('win64')
|
||||
let s:me = expand('<sfile>:p')
|
||||
|
||||
@@ -123,17 +122,9 @@ function! plug#end()
|
||||
augroup END
|
||||
augroup! PlugLOD
|
||||
endif
|
||||
let lod = {}
|
||||
|
||||
filetype off
|
||||
if exists('#filetypeplugin') &&
|
||||
\ !empty(filter(values(g:plugs), 'has_key(v:val, "for")'))
|
||||
unlet! g:did_load_ftplugin
|
||||
augroup filetypeplugin
|
||||
autocmd!
|
||||
augroup END
|
||||
augroup! filetypeplugin
|
||||
endif
|
||||
|
||||
" we want to make sure the plugin directories are added to rtp in the same
|
||||
" order that they are registered with the Plug command. since the s:add_rtp
|
||||
" function uses ^= to add plugin directories to the front of the rtp, we
|
||||
@@ -168,12 +159,21 @@ function! plug#end()
|
||||
for vim in split(globpath(s:rtp(plug), 'ftdetect/**/*.vim'), '\n')
|
||||
execute 'source '.vim
|
||||
endfor
|
||||
augroup PlugLOD
|
||||
execute printf('autocmd FileType %s call <SID>lod_ft(%s, %s)',
|
||||
\ join(s:to_a(plug.for), ','), string(name), string(plug))
|
||||
augroup END
|
||||
for key in s:to_a(plug.for)
|
||||
if !has_key(lod, key)
|
||||
let lod[key] = []
|
||||
endif
|
||||
call add(lod[key], name)
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
|
||||
for [key, names] in items(lod)
|
||||
augroup PlugLOD
|
||||
execute printf('autocmd FileType %s call <SID>lod_ft(%s, %s)',
|
||||
\ key, string(key), string(reverse(names)))
|
||||
augroup END
|
||||
endfor
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
endfunction
|
||||
@@ -207,12 +207,12 @@ function! s:lod(plug, types)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:lod_ft(name, plug)
|
||||
if has_key(s:loaded, a:name)
|
||||
return
|
||||
endif
|
||||
call s:lod(a:plug, ['plugin', 'after'])
|
||||
let s:loaded[a:name] = 1
|
||||
function! s:lod_ft(pat, names)
|
||||
for name in a:names
|
||||
call s:lod(g:plugs[name], ['plugin', 'after'])
|
||||
endfor
|
||||
execute 'autocmd! PlugLOD FileType ' . a:pat
|
||||
let &l:filetype = &l:filetype
|
||||
endfunction
|
||||
|
||||
function! s:lod_cmd(cmd, bang, l1, l2, args, plug)
|
||||
|
||||
Reference in New Issue
Block a user