kynan / dokuvimki

DokuVimKi is a Vim plugin which allows you to edit DokuWiki pages of DokuWikis XML-RPC interface. It also does syntax highlighting for DokuWiki syntax.
MIT License
32 stars 4 forks source link

Unable to quit vim after editing files outside DokuWiki #19

Closed alazyworkaholic closed 4 years ago

alazyworkaholic commented 4 years ago

The following commands will leave you stuck in DokuVimKi without being able to quit. Even qa! seems to be reinterpreted to DWquit!, which results in the same errors.

:Doku
:DWedit playground
:sp 
:e anyname
:ls
 10 #a    "playground"  line 1
 11 %a    "anyname"     line 1
:bd 10

:DWquit
Some buffers contain unsaved changes. Use DWquit! if you really want to quit.

:DWquit!

Error detected while processing function provider#python3#Call:
line 18:
Error invoking 'python_execute' on channel 4 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 605, in quit
  File "<string>", line 581, in close
  File "/usr/local/lib/python3.7/dist-packages/pynvim/api/nvim.py", line 287, in command
    return self.request('nvim_command', string, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynvim/msgpack_rpc/session.py", line 104, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim(bdelete):E516: No buffers were deleted

:bd 11
:DWquit!

Error detected while processing function proider#python3#Call:
line  18:
Error invoking 'python_execute' on channel 4 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 605 , in quit
  File "<string>", line 580, in close
  File "/usr/local/lib/python3.7/dist-packages/pynvim/api/nvim.py", line 287, in command
    return self.request('nvim_command', string, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynvim/msgpack_rpc/session.py", line 104, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim(bprevious):E85: There is no listed buffer
kynan commented 4 years ago

It looks like the problem is manually deleting the buffer. When you exit, we try to delete this buffer since it's still in DokuVimKi's buffer list, but no longer in vim's.

Solving this properly would require DokuVimKi intercepting a buffer delete and removing a deleted buffer from its state. Not sure this is even possible.

I will try simply ignoring the failure on buffer deletion.