From 87fff4894166247dbee8707c23d83d1e2eed3249 Mon Sep 17 00:00:00 2001 From: JulioJu Date: Thu, 12 Apr 2018 19:02:05 +0200 Subject: [PATCH] improve prettier configuration --- plugin/defaults.vim | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/plugin/defaults.vim b/plugin/defaults.vim index 5bf7d6a..9d2caaa 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -21,6 +21,10 @@ if !exists('g:autoformat_verbosemode') let g:autoformat_verbosemode = 0 endif +if !exists('g:formatdef_prettier') + let g:formatdef_prettier = '"prettier"' +endif + " Python if !exists('g:formatdef_autopep8') @@ -159,12 +163,6 @@ 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 @@ -254,7 +252,7 @@ if !exists('g:formatters_javascript') \ 'jsbeautify_javascript', \ 'jscs', \ 'standard_javascript', - \ 'prettier_javascript', + \ 'prettier', \ 'xo_javascript', \ ] endif @@ -274,11 +272,11 @@ if !exists('g:formatdef_fixjson') let g:formatdef_fixjson = '"fixjson"' endif - if !exists('g:formatters_json') let g:formatters_json = [ \ 'jsbeautify_json', \ 'fixjson', + \ 'prettier', \ ] endif @@ -343,19 +341,22 @@ if !exists('g:formatdef_cssbeautify') endif if !exists('g:formatters_css') - let g:formatters_css = ['cssbeautify'] + let g:formatters_css = ['cssbeautify', 'prettier'] endif - " SCSS if !exists('g:formatdef_sassconvert') let g:formatdef_sassconvert = '"sass-convert -F scss -T scss --indent " . (&expandtab ? shiftwidth() : "t")' endif if !exists('g:formatters_scss') - let g:formatters_scss = ['sassconvert'] + let g:formatters_scss = ['sassconvert', 'prettier'] endif +" Less +if !exists('g:formatters_less') + let g:formatters_less = ['prettier'] +endif " Typescript if !exists('g:formatdef_tsfmt') @@ -363,7 +364,7 @@ if !exists('g:formatdef_tsfmt') endif if !exists('g:formatters_typescript') - let g:formatters_typescript = ['tsfmt'] + let g:formatters_typescript = ['tsfmt', 'prettier'] endif @@ -439,7 +440,12 @@ if !exists('g:formatdef_remark_markdown') endif if !exists('g:formatters_markdown') - let g:formatters_markdown = ['remark_markdown'] + let g:formatters_markdown = ['remark_markdown', 'prettier'] +endif + +" Graphql +if !exists('g:formatters_graphql') + let g:formatters_graphql = ['prettier'] endif " Fortran