0

I am trying to handle events of nvim using nvim_subscribe() API via RPC. For instance, calling nvim_subscribe('CmdLineEnter').

I am not sure the specification of this API exactly, but I imagine that the notification will be call back to the client when the 'CmdLineEnter' event occurs in nvim. Is my understanding correct?

0

I found a solution to subscribe to events.

First monitor the event you want to subscribe with autocmd, and emit the event I defined myself by using rpcnotify(). For instance, define an autocmd in init.vim as below:

autocmd CmdLineEnter * call rpcnotify(0, 'mymethod')

Or define it by nvim_command(above autocmd) via RPC.

Then, after execute nvim_subscribe('mymethod'), nvim notifies mymethod event to the client via RPC whenever CmdLineEnter event happens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.