By differentiating the distinct cursor colors in the Chinese, English, and caps lock states, we can gain a better understanding of the current status of the input method and make informed decisions regarding the next operation.
Video_2024-09-19_183414.mp4
im-switch-for-windows.nvim
use binary tools to switch IM, you need to:
- Install binary tools on different OS.
- Make sure the executable file in a path that Neovim can read them.
Please install im-switch.exe
and put it into your PATH
.
Download URL: im-switch
You can check if the im-switch
executable can be properly accessed from Neovim by running the following command from your Command Prompt:
# find the command
$ where im-switch.exe
# Get current im name
$ im-switch.exe
# Try to switch to English keyboard
$ im-switch.exe en
# Try to switch to Chinese keyboard
$ im-switch.exe zh
Or run shell command directly from Neovim
:!where im-switch.exe
:!im-switch.exe zh
A good-enough minimal config in Lazy.nvim
{
"iamxiaojianzheng/im-switch-for-windows.nvim",
config = function()
require("im_select").setup({})
end,
}
Options with its default values
{
"iamxiaojianzheng/im-switch-for-windows.nvim",
opts = {
-- default is ok
default_command = "im-switch.exe",
-- default get from vim.opt.guicursor
default_guicursor = nil,
color = {
-- The color the cursor displays when caps mode is enabled.
caps = "yellow",
-- The color of the cursor when Chinese mode is enabled.
zh = "red",
-- The color of the cursor when English mode is enabled.
en = "white",
},
-- custom highlight group name
hl = {
caps = "CursorCaps",
zh = "CursorZh",
en = "Cursor",
},
},
config = function(_, opts)
require("im_select").setup(opts)
end,
}
- Required Lua, so only work in Neovim
- Required guicursor support