mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-06 09:04:23 +08:00
Compare commits
7 Commits
73f8bbc36b
...
7655e8218f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7655e8218f | ||
|
|
a7d4a73dd6 | ||
|
|
00d3f0ada6 | ||
|
|
a78b28a318 | ||
|
|
66e48daac3 | ||
|
|
fa165cd592 | ||
|
|
bd33a4337d |
18
README.md
18
README.md
@@ -1,21 +1,3 @@
|
|||||||
<div align="center">
|
|
||||||
<sup>Special thanks to:</sup>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<a href="https://warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=vimplug_20240209">
|
|
||||||
<div>
|
|
||||||
<img src="https://raw.githubusercontent.com/junegunn/i/master/warp.png" width="300" alt="Warp">
|
|
||||||
</div>
|
|
||||||
<b>Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.</b>
|
|
||||||
<div>
|
|
||||||
<sup>Visit warp.dev to learn more.</sup>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<br>
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<h1 title="vim-plug">
|
<h1 title="vim-plug">
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="./plug-dark.png">
|
<source media="(prefers-color-scheme: dark)" srcset="./plug-dark.png">
|
||||||
|
|||||||
55
plug.vim
55
plug.vim
@@ -84,6 +84,9 @@ let s:TYPE = {
|
|||||||
\ }
|
\ }
|
||||||
let s:loaded = get(s:, 'loaded', {})
|
let s:loaded = get(s:, 'loaded', {})
|
||||||
let s:triggers = get(s:, 'triggers', {})
|
let s:triggers = get(s:, 'triggers', {})
|
||||||
|
let s:need_filetypeplugin_au = 0
|
||||||
|
let s:need_filetypeindent_au = 0
|
||||||
|
let s:autocmd_queue_for_vimenter = []
|
||||||
|
|
||||||
function! s:is_powershell(shell)
|
function! s:is_powershell(shell)
|
||||||
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
|
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
|
||||||
@@ -323,6 +326,21 @@ function! plug#end()
|
|||||||
if get(g:, 'did_load_filetypes', 0)
|
if get(g:, 'did_load_filetypes', 0)
|
||||||
filetype off
|
filetype off
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let warn = []
|
||||||
|
if exists('g:did_load_ftplugin')
|
||||||
|
let warn += ['plugin']
|
||||||
|
let s:need_filetypeindent_au = 1
|
||||||
|
endif
|
||||||
|
if exists('g:did_indent_on')
|
||||||
|
let warn += ['indent']
|
||||||
|
let s:need_filetypeplugin_au = 1
|
||||||
|
endif
|
||||||
|
if !empty(warn)
|
||||||
|
redraw
|
||||||
|
call s:warn('echom', printf('[vim-plug] "filetype %s on" should not be used manually with vim-plug, please remove it from your vimrc.', join(warn)))
|
||||||
|
endif
|
||||||
|
|
||||||
for name in g:plugs_order
|
for name in g:plugs_order
|
||||||
if !has_key(g:plugs, name)
|
if !has_key(g:plugs, name)
|
||||||
continue
|
continue
|
||||||
@@ -398,7 +416,21 @@ function! plug#end()
|
|||||||
if has('syntax') && !exists('g:syntax_on')
|
if has('syntax') && !exists('g:syntax_on')
|
||||||
syntax enable
|
syntax enable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
" NOTE: v:vim_did_enter might not exist with older Vims, and handling it
|
||||||
|
" manually can be used in tests.
|
||||||
|
let s:vim_did_enter = 0
|
||||||
|
function! s:plug_on_vimenter()
|
||||||
|
let s:vim_did_enter = 1
|
||||||
|
for event in s:autocmd_queue_for_vimenter
|
||||||
|
call s:doautocmd(event)
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
augroup PlugLOD
|
||||||
|
autocmd VimEnter * call s:plug_on_vimenter()
|
||||||
|
augroup END
|
||||||
else
|
else
|
||||||
|
let s:vim_did_enter = 1
|
||||||
call s:reload_plugins()
|
call s:reload_plugins()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -561,6 +593,12 @@ function! s:reorg_rtp()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:doautocmd(...)
|
function! s:doautocmd(...)
|
||||||
|
if !s:vim_did_enter
|
||||||
|
if index(s:autocmd_queue_for_vimenter, a:000) == -1
|
||||||
|
call add(s:autocmd_queue_for_vimenter, a:000)
|
||||||
|
endif
|
||||||
|
return
|
||||||
|
endif
|
||||||
if exists('#'.join(a:000, '#'))
|
if exists('#'.join(a:000, '#'))
|
||||||
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
|
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
|
||||||
endif
|
endif
|
||||||
@@ -571,9 +609,7 @@ function! s:dobufread(names)
|
|||||||
let path = s:rtp(g:plugs[name])
|
let path = s:rtp(g:plugs[name])
|
||||||
for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
|
for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
|
||||||
if len(finddir(dir, path))
|
if len(finddir(dir, path))
|
||||||
if exists('#BufRead')
|
call s:doautocmd('BufRead')
|
||||||
doautocmd BufRead
|
|
||||||
endif
|
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@@ -647,8 +683,17 @@ function! s:lod_ft(pat, names)
|
|||||||
let syn = 'syntax/'.a:pat.'.vim'
|
let syn = 'syntax/'.a:pat.'.vim'
|
||||||
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
|
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
|
||||||
execute 'autocmd! PlugLOD FileType' a:pat
|
execute 'autocmd! PlugLOD FileType' a:pat
|
||||||
call s:doautocmd('filetypeplugin', 'FileType')
|
|
||||||
call s:doautocmd('filetypeindent', 'FileType')
|
" Executing this is only necessary if "filetype plugin indent on" was used
|
||||||
|
" before plug#end, and can be skipped when Vim has not entered always.
|
||||||
|
if s:vim_did_enter
|
||||||
|
if s:need_filetypeplugin_au
|
||||||
|
call s:doautocmd('filetypeplugin', 'FileType')
|
||||||
|
endif
|
||||||
|
if s:need_filetypeindent_au
|
||||||
|
call s:doautocmd('filetypeindent', 'FileType')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
|||||||
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
|
" Trigger VimEnter (simulate Vim being started), so that s:lod handles
|
||||||
|
" filetypeindent/filetypeplugin."
|
||||||
|
doautocmd VimEnter
|
||||||
|
|
||||||
redir => out
|
redir => out
|
||||||
tabnew a.c
|
tabnew a.c
|
||||||
redir END
|
redir END
|
||||||
|
|||||||
@@ -1230,7 +1230,7 @@ Execute (Filetype-based on-demand loading):
|
|||||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
||||||
|
|
||||||
setf xxx
|
setf xxx
|
||||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent'], g:xxx
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
|
||||||
|
|
||||||
" syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
|
" syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
|
||||||
setf yyy
|
setf yyy
|
||||||
|
|||||||
Reference in New Issue
Block a user