This Neovim plugin switches the IME when InsertEnter/InsertLeave events occur.
With lazy.nvim:
{
"hnjae/fcitx.nvim",
-- default-config:
opts = {
---@type number?
sleep = 0
---@type boolean?|fun(): boolean
enable = function()
return vim.fn.has("linux") == 1
and os.getenv("SSH_TTY") == nil
and os.getenv("DISPLAY") ~= nil
and os.getenv("XMODIFIERS") == "@im=fcitx"
and vim.fn.executable("fcitx5-remote") == 1
end
},
},
This option adds a delay in switching to a non-Latin character IME. As of 2023, not having this delay exposes a bug in Wayland that triggers key repeat behavior when typing Korean via Wayland protocol (e.g., text-input-v3). If you encounter a similar bug, consider using this option. Without the sleep option, the IME will change immediately.
fcitx5-wayland-bug.mp4
Differences compare to h-hg's version
- Includes the sleep option.
- IME switching scope is window-based, not buffer-based. The same buffer in different windows will have independent IME status.
- No cmdline event handling.
- GPL3 License.