From e179f61aad3390af441e2469bb700a9d5ce919bf Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Wed, 21 Jun 2017 21:40:37 -0700 Subject: add json parser --- ftplugin/json.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 ftplugin/json.vim (limited to 'ftplugin') diff --git a/ftplugin/json.vim b/ftplugin/json.vim new file mode 100644 index 0000000..b5751ca --- /dev/null +++ b/ftplugin/json.vim @@ -0,0 +1,10 @@ +let b:prettier_ft_default_args = { + \ 'parser': 'json' + \ } + +augroup Prettier + autocmd! + if g:prettier#autoformat + autocmd BufWritePre call prettier#Autoformat() + endif +augroup end -- cgit v1.3 From 416f20a4cae4e58313c1f68d876b69e00ce69d91 Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Thu, 29 Jun 2017 17:36:03 -0700 Subject: add graphql parser + bump for prettier 1.5 --- README.md | 2 +- doc/prettier.txt | 2 +- ftplugin/graphql.vim | 10 ++++++++++ package.json | 2 +- plugin/prettier.vim | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 ftplugin/graphql.vim (limited to 'ftplugin') diff --git a/README.md b/README.md index 3116962..07f0641 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ g:prettier#config#jsx_bracket_same_line = 'true' " none|es5|all g:prettier#config#trailing_comma = 'all' -" flow|babylon|typescript|postcss|json +" flow|babylon|typescript|postcss|json|graphql g:prettier#config#parser = 'flow' ``` diff --git a/doc/prettier.txt b/doc/prettier.txt index 3b75d8c..3ef8c82 100644 --- a/doc/prettier.txt +++ b/doc/prettier.txt @@ -118,7 +118,7 @@ Overwrite default prettier configuration " none|es5|all g:prettier#config#trailing_comma = 'all' - " flow|babylon|typescript|postcss|json + " flow|babylon|typescript|postcss|json|graphql g:prettier#config#parser = 'flow' < ============================================================================== diff --git a/ftplugin/graphql.vim b/ftplugin/graphql.vim new file mode 100644 index 0000000..bfb7b34 --- /dev/null +++ b/ftplugin/graphql.vim @@ -0,0 +1,10 @@ +let b:prettier_ft_default_args = { + \ 'parser': 'graphql' + \ } + +augroup Prettier + autocmd! + if g:prettier#autoformat + autocmd BufWritePre call prettier#Autoformat() + endif +augroup end diff --git a/package.json b/package.json index 9d6eb0a..f091e1e 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,6 @@ "url": "git://github.com/mitermayer/vim-prettier.git" }, "dependencies": { - "prettier": "^1.4.4" + "prettier": "^1.5.2" } } diff --git a/plugin/prettier.vim b/plugin/prettier.vim index fd1e4a8..b89ebb5 100644 --- a/plugin/prettier.vim +++ b/plugin/prettier.vim @@ -51,7 +51,7 @@ let g:prettier#config#jsx_bracket_same_line = get(g:,'prettier#config#jsx_bracke " none|es5|all let g:prettier#config#trailing_comma = get(g:,'prettier#config#trailing_comma', 'all') -" flow|babylon|typescript|postcss|json +" flow|babylon|typescript|postcss|json|graphql let g:prettier#config#parser = get(g:,'prettier#config#parser', 'flow') " synchronous by default -- cgit v1.3