aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorChris LaRose <cjlarose@gmail.com>2020-04-07 11:05:54 -0700
committerChris LaRose <cjlarose@gmail.com>2020-04-07 22:29:42 -0700
commit62ea1dc2110ff760af167633c71a6e469011b9c6 (patch)
tree8af5603b0aacad06a86f2363e7a245f4ad0873a5 /autoload
parentb016b933523b428c664d7a02a69c9b499c600abb (diff)
downloadvim-prettier-62ea1dc2110ff760af167633c71a6e469011b9c6.tar.xz
Force reevaluation of autoformat settings at buffer write time
Diffstat (limited to 'autoload')
-rw-r--r--autoload/prettier.vim12
1 files changed, 9 insertions, 3 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim
index ebe6abd..a9533f4 100644
--- a/autoload/prettier.vim
+++ b/autoload/prettier.vim
@@ -36,9 +36,15 @@ endfunction
" Allows @format and @prettier pragma support upon saving
function! prettier#Autoformat(...) abort
- call prettier#Prettier(1, 1, line('$'), 0, {
- \ 'requirePragma': g:prettier#autoformat_require_pragma ? 'true' : 'false'
- \ })
+ let l:autoformat = g:prettier#autoformat_config_present ?
+ \ prettier#IsConfigPresent(g:prettier#autoformat_config_files) :
+ \ g:prettier#autoformat
+
+ if l:autoformat
+ call prettier#Prettier(1, 1, line('$'), 0, {
+ \ 'requirePragma': g:prettier#autoformat_require_pragma ? 'true' : 'false'
+ \ })
+ endif
endfunction
" Main prettier command