Skip to content

Latest commit

 

History

History
95 lines (70 loc) · 2.22 KB

README.md

File metadata and controls

95 lines (70 loc) · 2.22 KB

im-switch-for-windows.nvim

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

Install and check binary

im-switch-for-windows.nvim use binary tools to switch IM, you need to:

  1. Install binary tools on different OS.
  2. Make sure the executable file in a path that Neovim can read them.

1.1 Windows

Install

Please install im-switch.exe and put it into your PATH.

Download URL: im-switch

Check

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

Install and setup this plugin

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,
}

Limitations

  • Required Lua, so only work in Neovim
  • Required guicursor support