diff options
| author | Mitermayer Reis <mitermayer.reis@gmail.com> | 2017-06-06 12:27:50 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-06 12:27:50 -0700 |
| commit | c28004d9c616a3599e8d0622c87fa071aa2342e8 (patch) | |
| tree | fb0924bf23922badf6f025b1e645189a75977d1c /README.md | |
| parent | b394b4c23622fe3aae78333d7830bc5dabf11e50 (diff) | |
| parent | a3df2e771010f9c70e74fadda32dd81a28b88f4f (diff) | |
| download | vim-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 'README.md')
| -rw-r--r-- | README.md | 33 |
1 files changed, 19 insertions, 14 deletions
@@ -2,7 +2,7 @@ A vim plugin wrapper for prettier, pre-configured with custom default prettier settings. -By default it will auto format javascript files that have "@format" annotation in the header of the file. +By default it will auto format **javascript**, **typescript**, **less**, **scss** and **css** files that have "@format" annotation in the header of the file.  @@ -11,8 +11,10 @@ By default it will auto format javascript files that have "@format" annotation i Install with [vim-plug](https://github.com/junegunn/vim-plug), assumes node and yarn|npm installed globally. ``` -" yarn install | npm install -Plug 'mitermayer/vim-prettier', { 'do': 'yarn install', 'for': 'javascript' } +" post install (yarn install | npm install) then load plugin only for editing supported files +plug 'mitermayer/vim-prettier', { + \ 'do': 'yarn install', + \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss'] } ``` If using other vim plugin managers or doing manual setup make sure to have `prettier` installed globally or go to your vim-prettier directory and either do `npm install` or `yarn install` @@ -29,32 +31,35 @@ vim-prettier executable resolution: ## USAGE -Formats the entire buffer - -### Commands - -Prettier can be manualy triggered by: +Prettier by default will run on auto save but can also be manualy triggered by: ``` <Leader>p ``` - -### Configuration +or ``` :Prettier ``` -Disable auto formatting of javascript files that have "@format" tag +## Configuration + +Disable auto formatting of files that have "@format" tag ``` let g:prettier#autoformat = 0 ``` -Enable vim-prettier to run in javascript files without the "@format" doc tag +The command `:Prettier` by default is synchronous but can be forced to be async + +``` +let g:prettier#exec_cmd_async = 1 +``` + +Enable vim-prettier to run in files without requiring the "@format" doc tag ``` -autocmd BufWritePre *.js call prettier#Prettier() + autocmd BufWritePre *.js,*.css,*.scss,*.less call prettier#Prettier() ``` Overwrite default configuration @@ -84,7 +89,7 @@ g:prettier#config#jsx_bracket_same_line = 'true' " none|es5|all g:prettier#config#trailing_comma = 'all' -" flow|babylon +" flow|babylon|typescript|postcss g:prettier#config#parser = 'flow' ``` |
