aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorHyeon Kim <simnalamburt@gmail.com>2020-02-09 04:06:15 +0900
committerHyeon Kim <simnalamburt@gmail.com>2020-02-09 04:08:21 +0900
commit8a3fa163dcf78a23fcace64f675365ab47fee1b8 (patch)
treeeb9f4b818aa90ab9217e743ebfb0463afccd52c9 /README.md
parent56fb126b73516756ab71c1c71b888b3b36bcf3fe (diff)
downloadvim-prettier-8a3fa163dcf78a23fcace64f675365ab47fee1b8.tar.xz
New option: prettier#autoformat_require_pragma
The 'prettier#autoformat_config_present' option is useful but it only worked with files with pragma. Now, you can use 'autoformat_config_present' even with files without pragma using this 'autoformat_require_pragma' option.
Diffstat (limited to 'README.md')
-rw-r--r--README.md25
1 files changed, 8 insertions, 17 deletions
diff --git a/README.md b/README.md
index c70703a..feb6b4b 100644
--- a/README.md
+++ b/README.md
@@ -138,6 +138,12 @@ Enable auto formatting of files that have "@format" or "@prettier" tag
let g:prettier#autoformat = 1
```
+Allow auto formatting for files without "@format" or "@prettier" tag
+
+```vim
+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!
```vim
@@ -181,28 +187,13 @@ By default we auto focus on the quickfix when there are errors but can also be d
let g:prettier#quickfix_auto_focus = 0
```
-To enable vim-prettier to auto run in files without requiring the "@format" or "@prettier" doc tag.
-First ensure that `g:prettier#autoformat` is not enabled on your `vimrc` (it should be disabled by default), then update to your own custom behaviour
-
-Running before saving sync:
-
-```vim
-autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html Prettier
-```
-
-Running before saving async (vim 8+):
-
-```vim
-autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
-```
-
-Running before saving, changing text or leaving insert mode:
+To running vim-prettier not only before saving, but also after changing text or leaving insert mode:
```vim
" when running at every change you may want to disable quickfix
let g:prettier#quickfix_enabled = 0
-autocmd BufWritePre,TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
+autocmd TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
```
### Overwrite default prettier configuration