From 066097e0b9eeb9066ba8974d9718c5b26b82cffc Mon Sep 17 00:00:00 2001 From: hank Date: Wed, 6 Nov 2019 10:14:12 +0800 Subject: Use `get()` to check `g:prettier#autoformat` safely in ftplugin Due to the fact that `plugin` will be loaded after `ftplugin`(http://vimdoc.sourceforge.net/htmldoc/filetype.html#ftplugin-overrule), even we set `g:prettier#autoformat` in plugin/prettier.vim, it's treated as undefined in ftplugin/*.vim. This happened when using `vim-pathogen`. --- ftplugin/html.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftplugin/html.vim') diff --git a/ftplugin/html.vim b/ftplugin/html.vim index 76ad0af..e27828a 100644 --- a/ftplugin/html.vim +++ b/ftplugin/html.vim @@ -8,7 +8,7 @@ endif augroup Prettier autocmd! - if g:prettier#autoformat + if get(g:, 'prettier#autoformat') autocmd BufWritePre *.html call prettier#Autoformat() endif augroup end -- cgit v1.3