aboutsummaryrefslogtreecommitdiff
path: root/plugin/prettier.vim
diff options
context:
space:
mode:
authorMitermayer Reis <mitermayer.reis@gmail.com>2017-06-06 12:27:50 -0700
committerGitHub <noreply@github.com>2017-06-06 12:27:50 -0700
commitc28004d9c616a3599e8d0622c87fa071aa2342e8 (patch)
treefb0924bf23922badf6f025b1e645189a75977d1c /plugin/prettier.vim
parentb394b4c23622fe3aae78333d7830bc5dabf11e50 (diff)
parenta3df2e771010f9c70e74fadda32dd81a28b88f4f (diff)
downloadvim-prettier-0.0.5.tar.xz
Merge pull request #11 from mitermayer/feature/adding-support-for-new-parsers-bump-prettier0.0.5
Bumping support to latest prettier ^1.4.X, enabling support for css,scss,less,typescript formatting and allowing user configuration to enable async as the default for configuration for `:Prettier` command
Diffstat (limited to 'plugin/prettier.vim')
-rw-r--r--plugin/prettier.vim10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugin/prettier.vim b/plugin/prettier.vim
index 6b5fee4..729ec2e 100644
--- a/plugin/prettier.vim
+++ b/plugin/prettier.vim
@@ -4,8 +4,12 @@ endif
let g:loaded_prettier = 1
" => Plugin config
+" autoformating enabled by default upon saving
let g:prettier#autoformat = get(g:, 'g:prettier#autoformat', 1)
+" calling :Prettier by default runs synchronous
+let g:prettier#exec_cmd_async = get(g:, 'g:prettier#exec_cmd_async', 0)
+
" => Prettier CLI config
" max line lengh that prettier will wrap on
let g:prettier#config#print_width = get(g:, 'g:prettier#config#print_width', 80)
@@ -31,11 +35,13 @@ let g:prettier#config#jsx_bracket_same_line = get(g:,'g:prettier#config#jsx_brac
" none|es5|all
let g:prettier#config#trailing_comma = get(g:,'g:prettier#config#trailing_comma', 'all')
-" flow|babylon
+" flow|babylon|typescript|postcss
let g:prettier#config#parser = get(g:,'g:prettier#config#parser', 'flow')
-command! Prettier call prettier#Prettier()
+" synchronous by default
+command! Prettier call prettier#Prettier(g:prettier#exec_cmd_async)
+" map command
if !hasmapto('<Plug>(Prettier)') && maparg('<Leader>p', 'n') ==# ''
nmap <unique> <Leader>p <Plug>(Prettier)
endif