mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-07 01:24:27 +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_source = 'https://raw.github.com/junegunn/vim-plug/master/plug.vim'
|
||||||
let s:plug_file = 'Plugfile'
|
let s:plug_file = 'Plugfile'
|
||||||
let s:plug_buf = -1
|
let s:plug_buf = -1
|
||||||
let s:loaded = {}
|
|
||||||
let s:is_win = has('win32') || has('win64')
|
let s:is_win = has('win32') || has('win64')
|
||||||
let s:me = expand('<sfile>:p')
|
let s:me = expand('<sfile>:p')
|
||||||
|
|
||||||
@@ -123,17 +122,9 @@ function! plug#end()
|
|||||||
augroup END
|
augroup END
|
||||||
augroup! PlugLOD
|
augroup! PlugLOD
|
||||||
endif
|
endif
|
||||||
|
let lod = {}
|
||||||
|
|
||||||
filetype off
|
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
|
" 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
|
" 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
|
" 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')
|
for vim in split(globpath(s:rtp(plug), 'ftdetect/**/*.vim'), '\n')
|
||||||
execute 'source '.vim
|
execute 'source '.vim
|
||||||
endfor
|
endfor
|
||||||
augroup PlugLOD
|
for key in s:to_a(plug.for)
|
||||||
execute printf('autocmd FileType %s call <SID>lod_ft(%s, %s)',
|
if !has_key(lod, key)
|
||||||
\ join(s:to_a(plug.for), ','), string(name), string(plug))
|
let lod[key] = []
|
||||||
augroup END
|
endif
|
||||||
|
call add(lod[key], name)
|
||||||
|
endfor
|
||||||
endif
|
endif
|
||||||
endfor
|
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
|
filetype plugin indent on
|
||||||
syntax on
|
syntax on
|
||||||
endfunction
|
endfunction
|
||||||
@@ -207,12 +207,12 @@ function! s:lod(plug, types)
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_ft(name, plug)
|
function! s:lod_ft(pat, names)
|
||||||
if has_key(s:loaded, a:name)
|
for name in a:names
|
||||||
return
|
call s:lod(g:plugs[name], ['plugin', 'after'])
|
||||||
endif
|
endfor
|
||||||
call s:lod(a:plug, ['plugin', 'after'])
|
execute 'autocmd! PlugLOD FileType ' . a:pat
|
||||||
let s:loaded[a:name] = 1
|
let &l:filetype = &l:filetype
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_cmd(cmd, bang, l1, l2, args, plug)
|
function! s:lod_cmd(cmd, bang, l1, l2, args, plug)
|
||||||
|
|||||||
Reference in New Issue
Block a user