Closed myypo closed 4 months ago
Yes, we could add a fn handle(&self) -> i32
method on Buffer
, Window
and TabPage
. I'd merge a PR if you want to work on adding those.
P.S. all the handles are i32
because Neovim defines handle_T
as an int
, but are negative handles ever used?
Yes, we could add a
fn handle(&self) -> i32
method onBuffer
,Window
andTabPage
. I'd merge a PR if you want to work on adding those.
Ok, I will work on it then.
P.S. all the handles are
i32
because Neovim defineshandle_T
as anint
, but are negative handles ever used?
I haven't ever encountered negative handles but I think playing safe and just using i32
won't hurt.
Closed by #176.
Hi. I have encountered a need to use the
Buffer
struct's underlyingBufHandle
as a raw i32.Just to avoid the XY problem: I need to be able to format it as an i32 to pass it in a buffer-local
set_keymap
as right side of the keymap that invokes another plugin function. I can't use a callback instead of rhs for this because my plugin's functions rely on state from a separate non-nvim thread that the plugin spawns on startup.Since it is impossible to implement a non-conflicting From/Into because of this implementation:
What I came up with so far is such method: