From 29449e7a155b858085ddfe3cab1f770464a68cdf Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Thu, 16 Jul 2020 10:27:12 +0200 Subject: 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 --- autoload/prettier/job/async/neovim.vim | 2 ++ 1 file changed, 2 insertions(+) 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] -- cgit v1.3