mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
Fix #112: Do not suppress messages from ftplugin
This commit is contained in:
parent
4b3fbd1592
commit
0263370bd1
6
plug.vim
6
plug.vim
@ -315,7 +315,7 @@ function! plug#load(...)
|
||||
for name in a:000
|
||||
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||
endfor
|
||||
silent! doautocmd BufRead
|
||||
doautocmd BufRead
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@ -336,8 +336,8 @@ endfunction
|
||||
function! s:lod_ft(pat, names)
|
||||
call s:lod(a:names, ['plugin', 'after/plugin'])
|
||||
execute 'autocmd! PlugLOD FileType' a:pat
|
||||
silent! doautocmd filetypeplugin FileType
|
||||
silent! doautocmd filetypeindent FileType
|
||||
doautocmd filetypeplugin FileType
|
||||
doautocmd filetypeindent FileType
|
||||
endfunction
|
||||
|
||||
function! s:lod_cmd(cmd, bang, l1, l2, args, name)
|
||||
|
5
test/fixtures/.gitignore
vendored
Normal file
5
test/fixtures/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
fzf*
|
||||
xxx
|
||||
yyy
|
||||
z1
|
||||
z2
|
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
Normal file
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
Normal file
@ -0,0 +1 @@
|
||||
echomsg 'ftplugin'
|
16
test/run
16
test/run
@ -5,18 +5,20 @@ cd ..
|
||||
PLUG_SRC=$(pwd)/plug.vim
|
||||
cd - > /dev/null
|
||||
|
||||
export PLUG_FIXTURES=$(pwd)/fixtures
|
||||
|
||||
if [ ! -d vader.vim ]; then
|
||||
git clone https://github.com/junegunn/vader.vim.git
|
||||
fi
|
||||
|
||||
rm -rf fzf
|
||||
rm -rf $PLUG_FIXTURES/fzf
|
||||
if [ ! -d fzf-staged ]; then
|
||||
git clone https://github.com/junegunn/fzf.git fzf-staged
|
||||
git clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged
|
||||
fi
|
||||
|
||||
make_dirs() {
|
||||
mkdir -p "temp/$1"
|
||||
cd "temp/$1"
|
||||
mkdir -p "$PLUG_FIXTURES/$1"
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||
for d in *; do
|
||||
[ -d $d ] || continue
|
||||
@ -33,12 +35,12 @@ EOF
|
||||
}
|
||||
|
||||
init() {
|
||||
rm -rf temp/{xxx,yyy,z1,z2}
|
||||
rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
|
||||
|
||||
make_dirs xxx/ xxx
|
||||
make_dirs xxx/after xxx
|
||||
mkdir -p temp/xxx/doc
|
||||
cat > temp/xxx/doc/xxx.txt << DOC
|
||||
mkdir -p $PLUG_FIXTURES/xxx/doc
|
||||
cat > $PLUG_FIXTURES/xxx/doc/xxx.txt << DOC
|
||||
hello *xxx*
|
||||
DOC
|
||||
|
||||
|
@ -421,7 +421,7 @@ Execute (On-demand loading based on filetypes):
|
||||
**********************************************************************
|
||||
|
||||
Execute (Add unmanaged plugin):
|
||||
let fzf = fnamemodify(g:vader_file, ':h') . '/fzf'
|
||||
let fzf = expand('$PLUG_FIXTURES/fzf')
|
||||
Log fzf
|
||||
|
||||
call plug#begin()
|
||||
@ -479,7 +479,7 @@ Execute (PlugStatus should point out that the plugin is missing):
|
||||
|
||||
Execute (Deploy unmanaged plugin):
|
||||
Assert !exists(':FZF'), ':FZF command should not exist'
|
||||
call rename('fzf-staged', 'fzf')
|
||||
call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf)
|
||||
|
||||
Execute (PlugUpdate still should not care):
|
||||
PlugUpdate
|
||||
@ -732,12 +732,12 @@ Execute (Using custom dir):
|
||||
**********************************************************************
|
||||
Before (Clear global vars):
|
||||
let g:xxx = []
|
||||
set rtp-=$PWD/temp/xxx/
|
||||
set rtp-=$PWD/temp/xxx/after
|
||||
set rtp-=$PLUG_FIXTURES/xxx/
|
||||
set rtp-=$PLUG_FIXTURES/xxx/after
|
||||
|
||||
Execute (Immediate loading):
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/xxx'
|
||||
Plug '$PLUG_FIXTURES/xxx'
|
||||
call plug#end()
|
||||
|
||||
" FIXME:
|
||||
@ -751,7 +751,7 @@ Execute (Immediate loading):
|
||||
|
||||
Execute (Command-based on-demand loading):
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/xxx', { 'on': 'XXX' }
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
|
||||
call plug#end()
|
||||
|
||||
AssertEqual [], g:xxx
|
||||
@ -764,7 +764,7 @@ Execute (Command-based on-demand loading):
|
||||
|
||||
Execute (Filetype-based on-demand loading):
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/xxx', { 'for': 'xxx' }
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
|
||||
call plug#end()
|
||||
|
||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
||||
@ -779,10 +779,10 @@ Before:
|
||||
**********************************************************************
|
||||
|
||||
Execute (plug#helptags):
|
||||
silent! call delete(expand('$PWD/temp/xxx/doc/tags'))
|
||||
Assert !filereadable(expand('$PWD/temp/xxx/doc/tags'))
|
||||
silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
||||
Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
||||
AssertEqual 1, plug#helptags()
|
||||
Assert filereadable(expand('$PWD/temp/xxx/doc/tags'))
|
||||
Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
||||
|
||||
**********************************************************************
|
||||
~ Manual loading
|
||||
@ -823,7 +823,7 @@ Execute (PlugStatus should not contain (not loaded)):
|
||||
|
||||
Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/yyy', { 'on': [] }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
|
||||
call plug#end()
|
||||
|
||||
PlugStatus
|
||||
@ -837,8 +837,8 @@ Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
||||
|
||||
Execute (Load plugin from PlugStatus screen with L key in visual mode):
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/z1', { 'on': [] }
|
||||
Plug '$PWD/temp/z2', { 'for': [] }
|
||||
Plug '$PLUG_FIXTURES/z1', { 'on': [] }
|
||||
Plug '$PLUG_FIXTURES/z2', { 'for': [] }
|
||||
call plug#end()
|
||||
|
||||
PlugStatus
|
||||
@ -964,8 +964,8 @@ Execute (Plug directory with comma):
|
||||
Execute (Strict load order):
|
||||
let g:total_order = []
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/xxx'
|
||||
Plug '$PWD/temp/yyy', { 'for': ['xxx'] }
|
||||
Plug '$PLUG_FIXTURES/xxx'
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
||||
call plug#end()
|
||||
call EnsureLoaded()
|
||||
setf xxx
|
||||
@ -977,8 +977,8 @@ Execute (Strict load order):
|
||||
|
||||
let g:total_order = []
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/xxx', { 'for': ['xxx'] }
|
||||
Plug '$PWD/temp/yyy'
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
||||
Plug '$PLUG_FIXTURES/yyy'
|
||||
call plug#end()
|
||||
call EnsureLoaded()
|
||||
set rtp^=manually-prepended
|
||||
@ -994,8 +994,8 @@ Execute (Strict load order):
|
||||
|
||||
let g:total_order = []
|
||||
call plug#begin()
|
||||
Plug '$PWD/temp/xxx', { 'for': ['xxx'] }
|
||||
Plug '$PWD/temp/yyy', { 'for': ['xxx'] }
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
||||
call plug#end()
|
||||
call EnsureLoaded()
|
||||
setf xxx
|
||||
@ -1007,9 +1007,11 @@ Execute (Strict load order):
|
||||
|
||||
**********************************************************************
|
||||
Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home):
|
||||
call plug#begin('$PWD/temp')
|
||||
Plug '$PWD/temp/xxx'
|
||||
Plug '$PWD/temp/yyy'
|
||||
call plug#begin('$PLUG_FIXTURES')
|
||||
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': [] }
|
||||
Plug '$PLUG_FIXTURES/fzf'
|
||||
Plug '$PLUG_FIXTURES/xxx'
|
||||
Plug '$PLUG_FIXTURES/yyy'
|
||||
call plug#end()
|
||||
|
||||
" Remove z1, z2
|
||||
@ -1022,6 +1024,24 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
|
||||
AssertExpect 'Already clean', 1
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
||||
call plug#begin('$PLUG_FIXTURES')
|
||||
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
||||
call plug#end()
|
||||
|
||||
redir => out
|
||||
tabnew a.c
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
|
||||
* The same applies to plug#load())
|
||||
redir => out
|
||||
call plug#load('ftplugin-msg')
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (PlugSnapshot):
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
@ -1047,7 +1067,7 @@ Execute (PlugSnapshot):
|
||||
Execute (Cleanup):
|
||||
silent! call system('rm -rf '.temp_plugged)
|
||||
silent! call system('rm -rf '.temp_plugged)
|
||||
silent! call rename('fzf', 'fzf-staged')
|
||||
silent! call rename(fzf, expand('$PLUG_FIXTURES/fzf-staged'))
|
||||
silent! unlet g:plugs
|
||||
silent! unlet g:plug_home
|
||||
silent! unlet g:plug_url_format
|
||||
|
Loading…
Reference in New Issue
Block a user