I get a human readable list of api functions using
:new|put =map(api_info().functions, 'v:val.name')
in neovim as suggested on https://neovim.io/doc/user/msgpack_rpc.html.
Problem is, this doesn't show the method signatures like the perl example on http://techblog.babyl.ca/entry/neovim-way-to-go.
#!/usr/bin/env perl use Neovim::RPC; my $rpc = Neovim::RPC->new->api->print_command;
... vim_replace_termcodes ( String str, Boolean from_part, Boolean do_lt, Boolean special ) -> String ... vim_set_current_line ( String line ) -> void ...
But: I don't use perl, I want to use python and want to print a formatted dump of the neovim api as suggested in https://neovim.io/doc/user/msgpack_rpc.html.
nvim --api-info | python -c 'import msgpack, sys, yaml; print( yaml.dump(msgpack.unpackb(sys.stdin.read())) )'
However, I get the following error:
Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/info/w/sc/lib/python3.4/codecs.py", line 319, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 0: invalid start byte
Trying to isolate the error, I did
nvim --api-info | python -c 'import sys; print( sys.stdin.read() )'
resulting in the same error as above.
I think the reason is me using python 3.4 not python 2.7. How do you correctly code this in python 3.4?
Moreover, there seems to be a discrepancy between the api function and the python implementation, e.g. if you want to access the api function
vim_set_current_line, you need to write
from neovim import attach v = attach('socket', path='/tmp/nvim') v.api.set_current_line("zzzz")
Is there a way to find out about "pythonic" api-functions (apart from consulting https://github.com/neovim/python-client/tree/master/neovim/api) ?