Trigger BufRead when a plugin is loaded by on condition

Close #489
This commit is contained in:
Junegunn Choi
2016-05-23 13:10:44 +09:00
parent a8b09617f9
commit 7c7ef8cf2f
3 changed files with 27 additions and 16 deletions

View File

@@ -7,13 +7,13 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
redir => out
tabnew a.c
redir END
Assert stridx(out, 'ftplugin') >= 0
Assert stridx(out, 'ftplugin-c') >= 0
* The same applies to plug#load())
redir => out
call plug#load('ftplugin-msg')
redir END
Assert stridx(out, 'ftplugin') >= 0
Assert stridx(out, 'ftplugin-c') >= 0
q
@@ -302,3 +302,16 @@ Execute (#474: Load ftdetect files in filetypedetect augroup):
AssertEqual 'rust', &filetype
Log &filetype
bd
**********************************************************************
Execute (#489 On-demand loading with 'on' option should trigger BufRead autocmd):
call plug#begin('$PLUG_FIXTURES')
Plug 'ftplugin-msg', { 'on': 'XXX' }
call plug#end()
tabnew a.java
redir => out
silent! XXX
redir END
Assert stridx(out, 'ftplugin-java') >= 0
q

View File

@@ -2,6 +2,7 @@
cd $(dirname "${BASH_SOURCE[0]}")
export HOME=/tmp
export BASE="$PWD"
export PLUG_SRC="$PWD/../plug.vim"
export PLUG_FIXTURES="$PWD/fixtures"
@@ -77,7 +78,8 @@ DOC
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
rm -rf /tmp/new-branch
cd /tmp