From be7a44c2e2f296332b07d052686c0d6a21b21d76 Mon Sep 17 00:00:00 2001 From: Andrew Vos Date: Wed, 21 Feb 2018 15:16:15 +0000 Subject: [PATCH] Add support for prettier for JavaScript https://prettier.io/ --- plugin/defaults.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugin/defaults.vim b/plugin/defaults.vim index 4c17350..5bf7d6a 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -159,6 +159,12 @@ if !exists('g:formatdef_standard_javascript') let g:formatdef_standard_javascript = '"standard --fix --stdin"' endif +if !exists('g:formatdef_prettier_javascript') + if filereadable('.prettierrc') + let g:formatdef_prettier_javascript = '"prettier"' + endif +endif + " This is an xo formatter (inspired by the above eslint formatter) " To support ignore and overrides options, we need to use a tmp file " So we create a tmp file here and then remove it afterwards @@ -248,7 +254,8 @@ if !exists('g:formatters_javascript') \ 'jsbeautify_javascript', \ 'jscs', \ 'standard_javascript', - \ 'xo_javascript' + \ 'prettier_javascript', + \ 'xo_javascript', \ ] endif