diff options
| author | mitermayer <mitermayer.reis@gmail.com> | 2017-06-07 11:11:43 -0700 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2017-06-07 11:11:43 -0700 |
| commit | e063d0ca656a7413da3cc6b543adde58a09f8c01 (patch) | |
| tree | ff4fe2d636b6026523352881e317eaa29dfd017c | |
| parent | c211c98ab7118be61873d0fe9897e5986c6f6441 (diff) | |
| download | vim-prettier-e063d0ca656a7413da3cc6b543adde58a09f8c01.tar.xz | |
Updating docs
| -rw-r--r-- | README.md | 22 | ||||
| -rw-r--r-- | doc/prettier.txt | 32 | ||||
| -rw-r--r-- | plugin/prettier.vim | 2 |
3 files changed, 37 insertions, 19 deletions
@@ -19,7 +19,7 @@ plug 'mitermayer/vim-prettier', { 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` -## Prettier Executable resolution +### Prettier Executable resolution When installed via vim-plug, a default prettier executable is installed inside vim-prettier. @@ -29,7 +29,7 @@ vim-prettier executable resolution: 2. Look for a global prettier installation 3. Use locally installed vim-prettier prettier executable -## USAGE +### USAGE Prettier by default will run on auto save but can also be manualy triggered by: @@ -48,7 +48,7 @@ If your are on vim 8+ you can also trigger async formatting by: :PrettierAsync ``` -## Configuration +### Configuration Disable auto formatting of files that have "@format" tag @@ -56,13 +56,13 @@ Disable auto formatting of files that have "@format" tag let g:prettier#autoformat = 0 ``` -The command `:Prettier` by default is synchronous but can be forced to be async +The command `:Prettier` by default is synchronous but can also be forced async ```vim let g:prettier#exec_cmd_async = 1 ``` -By default parsing errors will open the quickfix, that behaviour can be controlled by +By default parsing errors will open the quickfix but can also be disabled ```vim let g:prettier#quickfix_enabled = 0 @@ -74,28 +74,28 @@ First disable the default autoformat, then update to your own custom behaviour Running before saving sync: ```vim - let g:prettier#autoformat = 0 - autocmd BufWritePre *.js,*.css,*.scss,*.less Prettier +let g:prettier#autoformat = 0 +autocmd BufWritePre *.js,*.css,*.scss,*.less Prettier ``` Running before saving async (vim 8+): ```vim - let g:prettier#autoformat = 0 - autocmd BufWritePre *.js,*.css,*.scss,*.less PrettierAsync +let g:prettier#autoformat = 0 +autocmd BufWritePre *.js,*.css,*.scss,*.less PrettierAsync ``` Running before saving, changing text or leaving insert mode: ```vim -" when running at every change you may want to disable quickfix error parsing to reduce noise +" when running at every change you may want to disable quickfix let g:prettier#quickfix_enabled = 0 let g:prettier#autoformat = 0 autocmd BufWritePre,TextChanged,InsertLeave *.js,*.css,*.scss,*.less PrettierAsync ``` -Overwrite default configuration +### Overwrite default prettier configuration ```vim " max line lengh that prettier will wrap on diff --git a/doc/prettier.txt b/doc/prettier.txt index d26a299..e60dc22 100644 --- a/doc/prettier.txt +++ b/doc/prettier.txt @@ -52,6 +52,10 @@ or > :Prettier < +If your are on vim 8+ you can also trigger async formatting by: +> + :PrettierAsync +< ============================================================================== CONFIGURATION *vim-prettier-configuration* @@ -59,22 +63,36 @@ Disable auto formatting of files that have "@format" tag > let g:prettier#autoformat = 0 < -The command `:Prettier` by default is synchronous but can be forced to be async +The command `:Prettier` by default is synchronous but can also be forced async > let g:prettier#exec_cmd_async = 1 < -Enable vim-prettier to run in files without requiring the "@format" doc tag +By default parsing errors will open the quickfix but can also be disabled > - " => for older vim you can run it synchronous before saving - autocmd BufWritePre *.js,*.css,*.scss,*.less Prettier + let g:prettier#exec_cmd_async = 1 +< +To enable vim-prettier to run in files without requiring the "@format" doc tag. +First disable the default autoformat, then update to your own custom behaviour - " => vim greater than 8.0 has async support +Running before saving sync: +> + let g:prettier#autoformat = 0 + autocmd BufWritePre *.js,*.css,*.scss,*.less Prettier +< +Running before saving async (vim 8+): +> + let g:prettier#autoformat = 0 autocmd BufWritePre *.js,*.css,*.scss,*.less PrettierAsync +< +Running before saving, changing text or leaving insert mode: +> + let g:prettier#autoformat = 0 + " when running at every change you may want to disable quickfix + let g:prettier#quickfix_enabled = 0 - " => if you want prettier to run when changes happen autocmd BufWritePre,TextChanged,InsertLeave *.js,*.css,*.scss,*.less PrettierAsync < -Overwrite default configuration +Overwrite default prettier configuration > " max line lengh that prettier will wrap on g:prettier#config#print_width = 80 diff --git a/plugin/prettier.vim b/plugin/prettier.vim index 9ad1ae7..53bb4ed 100644 --- a/plugin/prettier.vim +++ b/plugin/prettier.vim @@ -6,7 +6,7 @@ " Description: A vim plugin wrapper for prettier, pre-configured with custom default prettier settings. " Maintainer: Mitermayer Reis <mitermayer.reis at gmail.com> " Version: 0.0.5 -" Usage: Use :help vim-prettier, or visit the Github page https://github.com/mitermayer/vim-prettier +" Usage: Use :help vim-prettier-usage, or visit https://github.com/mitermayer/vim-prettier " "========================================================================================================== " }}} |
