diff options
| author | hank <hankchiu.tw@gmail.com> | 2019-11-06 10:14:12 +0800 |
|---|---|---|
| committer | hank <hankchiu.tw@gmail.com> | 2019-11-06 10:22:11 +0800 |
| commit | 066097e0b9eeb9066ba8974d9718c5b26b82cffc (patch) | |
| tree | ad7cb5c70bf49944ff75ff877e18e1662386f948 /ftplugin/less.vim | |
| parent | 427ef6830294c722f04cd3799f2c27a6629976a6 (diff) | |
| download | vim-prettier-066097e0b9eeb9066ba8974d9718c5b26b82cffc.tar.xz | |
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`.
Diffstat (limited to 'ftplugin/less.vim')
| -rw-r--r-- | ftplugin/less.vim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ftplugin/less.vim b/ftplugin/less.vim index 53b8e2a..e1f18ce 100644 --- a/ftplugin/less.vim +++ b/ftplugin/less.vim @@ -4,7 +4,7 @@ let b:prettier_ft_default_args = { augroup Prettier autocmd! - if g:prettier#autoformat + if get(g:, 'prettier#autoformat') autocmd BufWritePre *.less call prettier#Autoformat() endif augroup end |
