Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve autoformatting docs #324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,22 @@ Allow auto formatting for files without "@format" or "@prettier" tag
let g:prettier#autoformat_require_pragma = 0
```

**NOTE** The previous two options can be used together for autoformatting files on save without `@format` or `@prettier` tags
**NOTE** The previous two options can be used together for autoformatting files on save without `@format` or `@prettier` tags.
In this case, all files are autoformatted despite a config file being present.

```vim
let g:prettier#autoformat = 1
let g:prettier#autoformat_require_pragma = 0
```

Toggle the `g:prettier#autoformat` setting based on whether a config file can be found in the current directory or any parent directory. Note that this will override the `g:prettier#autoformat` setting!
In case autoformatting is only desired when a config file is present:

```
let g:prettier#autoformat_config_present = 1
let g:prettier#autoformat_require_pragma = 0
```

To toggle the `g:prettier#autoformat` setting based on whether a config file can be found in the current directory or any parent directoryy use `autoformat_config_present`. Note that this will override the `g:prettier#autoformat` setting!

```vim
let g:prettier#autoformat_config_present = 1
Expand Down