From 33d19b72f4f97cccf68b1581f6d33b900bdb4b3c Mon Sep 17 00:00:00 2001 From: mitermayer Date: Sun, 3 Jun 2018 23:11:06 -0700 Subject: Adding documentation for prettier partial formatting --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index d0ec620..7c3c775 100644 --- a/README.md +++ b/README.md @@ -79,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 @@ -135,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 @@ -205,3 +228,5 @@ let g:prettier#config#prose_wrap = 'preserve' ### REQUIREMENT(S) If prettier installation can't be found no code formatting will happen +``` +```` -- cgit v1.3