diff options
| author | Arnaud Christ <arnaud.christ@gmail.com> | 2019-02-24 10:38:24 +0100 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2019-08-25 21:15:17 -0700 |
| commit | 1170c6f642beffe1b8a3aa877c4e7ab553837c6e (patch) | |
| tree | 1419fb6276eae4479136c8b23a7fb7a0270cc0bd | |
| parent | 3705a30708d3af3cd2c4adf6c33cf8b2bdc97d13 (diff) | |
| download | vim-prettier-1170c6f642beffe1b8a3aa877c4e7ab553837c6e.tar.xz | |
Fix README markdown.
| -rw-r--r-- | README.md | 54 |
1 files changed, 25 insertions, 29 deletions
@@ -9,30 +9,6 @@ settings. If you have feature request and/or suggestions please comment on issue [1.0 release](https://github.com/prettier/vim-prettier/issues/126) -If you want to try out the `release/1.x` branch feel free to add this to your `.vimrc` - -```vim -Plug 'prettier/vim-prettier', { - \ 'do': 'yarn install', - \ 'branch': 'release/1.x', - \ 'for': [ - \ 'javascript', - \ 'typescript', - \ 'css', - \ 'less', - \ 'scss', - \ 'json', - \ 'graphql', - \ 'markdown', - \ 'vue', - \ 'lua', - \ 'php', - \ 'python', - \ 'ruby', - \ 'html', - \ 'swift' ] } -``` - --- By default it will auto format **javascript**, **typescript**, **less**, @@ -56,7 +32,7 @@ Plug 'prettier/vim-prettier', { or simply enable for all formats by: ```vim -" post install (yarn install | npm install) +" post install (yarn install | npm install) then load plugin only for editing supported files Plug 'prettier/vim-prettier', { 'do': 'yarn install' } ``` @@ -103,6 +79,22 @@ If your are on vim 8+ you can also trigger async formatting by: :PrettierAsync ``` +You can send to prettier your entire buffer but ensure that it formats only your selection. + +**note: ** differs from `:PrettierFragment` by sending the entire buffer to prettier, allowing identation level to be preserved, but it requires the whole file to be valid. + +```vim +:PrettierPartial +``` + +You can send to prettier your current selection as a fragment of same type as the file being edited. + +**note: ** differs from `:PrettierFragment` by sending only the current selection to prettier, this allows for faster formatting but wont preserve indentation. + +```vim +:PrettierFragment +``` + You can check what is the `vim-prettier` plugin version by: ```vim @@ -159,6 +151,13 @@ By default parsing errors will open the quickfix but can also be disabled let g:prettier#quickfix_enabled = 0 ``` +By default selection formatting will be running `:PrettierFragment` but we can set +`:PrettierPartial` as the default selection formatting by: + +```vim +let g:prettier#partial_format=1 +``` + By default we auto focus on the quickfix when there are errors but can also be disabled ```vim @@ -224,11 +223,8 @@ let g:prettier#config#config_precedence = 'file-override' " always|never|preserve " default: 'preserve' let g:prettier#config#prose_wrap = 'preserve' - -" css|strict|ignore -let g:prettier#config#html_whitespace_sensitivity = 'css' ``` ### REQUIREMENT(S) -If the `prettier` executable can't be found by Vim, no code formatting will happen +If prettier installation can't be found no code formatting will happen |
