diff options
| author | mitermayer <mitermayer.reis@gmail.com> | 2018-06-03 23:11:06 -0700 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2019-08-25 21:13:01 -0700 |
| commit | 1d045d3c2ea7466d523b1bad64992d081d6de088 (patch) | |
| tree | 2d0f755120b53443039a73db996d8614e37be7a9 | |
| parent | d0dc8e2354e81f3e28ab3105298c0088f641c8e8 (diff) | |
| download | vim-prettier-1d045d3c2ea7466d523b1bad64992d081d6de088.tar.xz | |
Adding documentation for prettier partial formatting
| -rw-r--r-- | autoload/prettier/utils/buffer.vim | 2 | ||||
| -rw-r--r-- | doc/prettier.txt | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/autoload/prettier/utils/buffer.vim b/autoload/prettier/utils/buffer.vim index 0b3c619..258c615 100644 --- a/autoload/prettier/utils/buffer.vim +++ b/autoload/prettier/utils/buffer.vim @@ -35,7 +35,7 @@ function! prettier#utils#buffer#createBufferFromUpdatedLines(lines, start, end) endfunction " Adapted from https://github.com/farazdagi/vim-go-ide -function! s:getCharPosition(line, col) +function! s:getCharPosition(line, col) abort if &encoding !=# 'utf-8' " On utf-8 enconding we can't just use bytes so we need to make sure we can count the " characters, we do that by adding the text into a temporary buffer and counting the chars diff --git a/doc/prettier.txt b/doc/prettier.txt index f32f2d5..ef25cf0 100644 --- a/doc/prettier.txt +++ b/doc/prettier.txt @@ -90,7 +90,24 @@ You can check what is the resolved `prettier` cli path by: You can check what is the resolved `prettier` cli version by: > :PrettierCliVersion -< + +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. +> + :PrettierPartial + +You can send to prettier your current selection as a fragment of same type as +the file being edited. + +**note: ** differs from `:PrettierPartial` by sending only the current selection +to prettier, this allows for faster formatting but wont preserve indentation. +> + :PrettierFragment + ============================================================================== CONFIGURATION *vim-prettier-configuration* |
