aboutsummaryrefslogtreecommitdiff
path: root/autoload/prettier
diff options
context:
space:
mode:
authorThorsten Ball <mrnugget@gmail.com>2020-07-16 10:27:12 +0200
committerThorsten Ball <mrnugget@gmail.com>2020-07-16 10:27:12 +0200
commit29449e7a155b858085ddfe3cab1f770464a68cdf (patch)
tree49f7cc436d65aad39ae64cfbfe67580d8f38da18 /autoload/prettier
parentd927452f2db2c43dc78c6b62783b64670569e5c9 (diff)
downloadvim-prettier-29449e7a155b858085ddfe3cab1f770464a68cdf.tar.xz
Fix error when quitting Neovim with :wq
This fixes #215 by implementing the fix I've suggested in [my comment][0]. After [the suggestion to open a PR][1], here we are :) [0]: https://github.com/prettier/vim-prettier/issues/215#issuecomment-629681399 [1]: https://github.com/prettier/vim-prettier/issues/215#issuecomment-648657236
Diffstat (limited to 'autoload/prettier')
-rw-r--r--autoload/prettier/job/async/neovim.vim2
1 files changed, 2 insertions, 0 deletions
diff --git a/autoload/prettier/job/async/neovim.vim b/autoload/prettier/job/async/neovim.vim
index 7f69f4e..35e5f82 100644
--- a/autoload/prettier/job/async/neovim.vim
+++ b/autoload/prettier/job/async/neovim.vim
@@ -42,6 +42,8 @@ endfunction
"
" note that somehow we exectuing both async and sync on nvim when using the autoformat
function! s:onExit(status, info, out, err) abort
+ if len(a:out) == 0 | return | endif
+
let l:currentBufferNumber = bufnr('%')
let l:isInsideAnotherBuffer = a:info.buf_nr != l:currentBufferNumber ? 1 : 0
let l:last = a:out[len(a:out) - 1]