diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/prettier.txt | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/doc/prettier.txt b/doc/prettier.txt index 584595a..08550ed 100644 --- a/doc/prettier.txt +++ b/doc/prettier.txt @@ -5,6 +5,7 @@ CONTENTS *vim-prettier-contents* Introduction |vim-prettier-introduction| Install |vim-prettier-install| Usage |vim-prettier-usage| +Configuration |vim-prettier-configuration| Requirements |vim-prettier-requirements| ============================================================================== @@ -13,8 +14,8 @@ INTRODUCTION *vim-prettier-introduction* 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. When installed via vim-plug, a default prettier executable is installed inside vim-prettier. @@ -31,7 +32,9 @@ INSTALL *vim-prettier-install* Install with [vim-plug](https://github.com/junegunn/vim-plug), assumes node and yarn|npm installed globally. > - Plug 'mitermayer/vim-prettier', { 'do': 'yarn install', 'for': 'javascript' } + 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 @@ -40,21 +43,29 @@ either do `npm install` or `yarn install` ============================================================================== USAGE *vim-prettier-usage* -Prettier can be manualy triggered by: +Prettier by default will run on auto save but can also +be manualy triggered by: > <Leader>p < -Formats the entire buffer +or > :Prettier < -Disable auto formatting of javascript files that have "@format" tag +============================================================================== +CONFIGURATION *vim-prettier-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 > @@ -82,7 +93,7 @@ Overwrite default configuration " none|es5|all g:prettier#config#trailing_comma = 'all' - " flow|babylon + " flow|babylon|typescript|postcss g:prettier#config#parser = 'flow' < ============================================================================== |
