keaising / im-select.nvim

Switch Input Method automatically depends on Neovim's edit mode
MIT License
170 stars 25 forks source link

fix: `!uv__is_closing(handle)' failed when quit vim #10

Closed hieulw closed 1 year ago

hieulw commented 1 year ago

I'm noticing we use vim.fn.system to change input method. This function of neovim is blocked (synchronous) since it wait to get outputs from command. So whenever I exit vim :q, I get error like this:

neovim: src/unix/core.c:116: uv_close: Assertion `!uv__is_closing(handle)' failed

Quick fix is to replace vim.fn.system to vim.fn.jobstart since we don't actually need fcitx5-remote -s keyboard-us output. Or just wrap whole function with vim.schedule_wrap :P

keaising commented 1 year ago

Thanks for your PR!

I prefer vim.fn.jobstart, it is more clear for reader that we use async function.

Could you please change vim.fn.system to vim.fn.jobstart in https://github.com/hieulw/im-select.nvim/blob/fix/uv-closing-failed/lua/im_select.lua#L112-L126 ?

hieulw commented 1 year ago

I just updated my commits. I use vim.fn.jobstart with { detach = true } option so the job will not be killed when Nvim exits.