Closed suinming closed 1 year ago
Have you tried to execute fcitx5-remote -n
in your shell or :!fcitx5-remote -n
in nvim command mode?
Could you please provide the result?
Thanks for your reply. The following is the result in shell. The following is the result in neovim.
You should make sure fcitx5-remote
is included in nvim's path first.
im-select.nvim depends on fcitx5-remote
to switch input methods.
BTW, your config default_im_select = "com.apple.keylayout.ABC"
is not proper for fcitx5, it is default IM for macOS
fcitx5-remote
is included in nvim's pathdefault_im_select = keyboard-us
But the plugins still not work. Any advice??It seams that you use a different fcitx5-remote
version than me, your fcitx5-remote
is more like a fcitx-remote
Maybe you can:
export fcitx-remote=fcitx5-remote
fcitx-remote
works well in your nvimfcitx-remote
in config, e.g. default_command = 'fcitx-remote'
default_im_select = 1
In this method you can only activation/inactivate IM, use fcitx5-remote
as fcitx-remote
好像是中国人?
你的截图里显示你用的就是 Fcitx,不知道你的 fcitx5-remote
是咋来的,不是你自己改名字的吧?如果是你自己改名字的话就改回去,用 fcitx-remote
就好
由于获取不到当前输入法的名字,所以 im-select.nvim 对 fcitx-remote
只支持到开启和关闭输入法,不支持在多个输入法之间切换
还有一个问题是你的输入法分组可能也有问题, im-select.nvim 不支持切换分组,我不知道有多个分组的情况下会发生什么,只能你自己用 fcitx-remote
在命令行里试试了
im-select.nvim 本质上只是帮你在合适的时机调用 fcitx-remote
,所以你得先确保它能正常用
我比較好奇fcitx5-remote -n
-n 這個flag的意義?因為似乎沒有這個-n的選項
我装的 fcitx5 自带的 fcitx5-remote 有这个选项,意思是获取当前输入法的名字
你截图里的 fcitx5-remote 的行为和输出跟我安装的 fcitx 自带的 fcitx-remote 一致
首先,非常謝謝你的回覆。我蠻確定我使用的是fcitx5,還是沒弄懂為何沒有fcitx5-remote -n
這個指令可以用。
但還是想分享一下我的處理方式:
vim.api.nvim_create_autocmd({ "InsertLeave" }, {
pattern = { "*" },
callback = function()
local input_status = tonumber(vim.fn.system "fcitx5-remote")
if input_status == 1 then vim.fn.system "fcitx5-remote -t" end
end,
})
英文的部份input_status = 2, 中文的部份input_status = 1,所以若是離開insert mode將會自動把中文的輸入法切換為英文。
嗯嗯,跟我的 fcitx-remote
的表现完全一致,你可以考虑按照我上面说的,给 fcitx5-remote 加一个 alias 当成 fcitx-remote
,然后配置 default_command = fcitx-remote
,这样就只需要写配置,不用写上面那些代码
Anyway,能跑就行