Basic RPC to query values from the main Neovim instance within fn_transform
#2194
elanmed
started this conversation in
Show and tell
Replies: 1 comment 3 replies
-
no need serverstart another thing it's just expose a new socket handle that can be safely reused i guess fn-transform dont allow you to use vim.fn since it's run in callback of uv.write which is fast event maybe you can use fn-preprocess to do rpc and get+assign a global varible in your headless instance |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
👋 After our discussion in this thread, I started experimenting with using rpc to pass information between the main Neovim instance and the headless instances that run
fn_transform
so that I could enablemultiprocess=true
. This is a basic version I got working, any feedback is appreciated!I noticed that if I used the default
vim.v.servername
invim.fn.sockconnect
, I got errors that_G.fzf_exec_with_rpc_data
wasnil
- I'm assuming because thevim.v.servername
isn't necessarily the same between headless nvim instances and the main instance. Strangely, I only got this error when returning the rpc response fromfn_transform
- when just printing the response infn_transform
, it worked fine. Not too sure what to make of this, but I decided to try making my own rpc server that would stay constant.I saw that
fzf-lua
creates an rpc server and assigns it tovim.g.fzf_lua_server
and theFZF_LUA_SERVER
environment variable, which seemed like a cool way to share the server name between the main instance and the headless instances. I tried something similar, and it worked great:I asked chatgpt for a review, and it suggested stopping the server with something like this:
but I couldn't find anything similar in the
fzf-lua
repo. Curious if you have any thoughts?Beta Was this translation helpful? Give feedback.
All reactions