github github
stars 144
issues 6
subscribers 3
forks 21



4 months ago


Switch Input Method automatically depends on NeoVim's edit mode.

The old vim plugins (such as im-select) works weird on my Macbook, so I just create this im-select in pure lua for NeoVim, it works charmingly!

Current version works for NeoVim on:

  • macOS
  • Windows and WSL
  • Linux
    • Fcitx5
    • Fcitx(only switch between inactive and active)
    • IBus

Other frameworks on Linux's support is welcome!

1. Install and check binary

im-select.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 / WSL


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

Download URL: im-select (For x64 platform, please download the 64-bit version.)


You can check if the im-select executable can be properly accessed from Neovim/Vim by running the following command from your Command Prompt:

# find the command
$ where im-select.exe

# Get current im name
$ im-select.exe

# Try to switch to English keyboard
$ im-select.exe 1033

Or run shell command directly from NeoVim

:!where im-select.exe

:!im-select.exe 1003

1.2 macOS


Please install im-select

Download URL: im-select


Check installation in bash/zsh

# find binary
$ which im-select

# Get current im name
$ im-select

# Try to switch to English keyboard
$ im-select

Check in NeoVim

:!which im-select

1.3 Linux


Please install and config one of Input Methods: Fcitx / Fcitx5 / IBus


Check installation in bash/zsh

> Fcitx

# find
$ which fcitx-remote

# activate IM
$ fcitx-remote -o

# inactivate IM
$ fcitx-remote -c

> Fcitx5

# find
$ which fcitx5-remote

# Get current im name
$ fcitx5-remote -n

# Try to switch to English keyboard
$ fcitx5-remote keyboard-us

> IBus

# find
$ which ibus

# Get current im name
$ ibus engine

# Try to switch to English keyboard
$ ibus xkb:us::eng

Check in NeoVim

# find
:!which fcitx
:!which fcitx5
:!which ibus

2. Install and setup this plugin

A good-enough minimal config in Lazy.nvim

    config = function()

Options with its default values

    config = function()
            -- IM will be set to `default_im_select` in `normal` mode
            -- For Windows/WSL, default: "1033", aka: English US Keyboard
            -- For macOS, default: "", aka: US
            -- For Linux, default:
            --               "keyboard-us" for Fcitx5
            --               "1" for Fcitx
            --               "xkb:us::eng" for ibus
            -- You can use `im-select` or `fcitx5-remote -n` to get the IM's name
            default_im_select  = "",

            -- Can be binary's name or binary's full path,
            -- e.g. 'im-select' or '/usr/local/bin/im-select'
            -- For Windows/WSL, default: "im-select.exe"
            -- For macOS, default: "im-select"
            -- For Linux, default: "fcitx5-remote" or "fcitx-remote" or "ibus"
            default_command = 'im-select.exe',

            -- Restore the default input method state when the following events are triggered
            set_default_events = { "VimEnter", "FocusGained", "InsertLeave", "CmdlineLeave" },

            -- Restore the previous used input method state when the following events
            -- are triggered, if you don't want to restore previous used im in Insert mode,
            -- e.g. deprecated `disable_auto_restore = 1`, just let it empty
            -- as `set_previous_events = {}`
            set_previous_events = { "InsertEnter" },

            -- Show notification about how to install executable binary when binary missed
            keep_quiet_on_no_binary = false,

            -- Async run `default_command` to switch IM or not
            async_switch_im = true

3. Current Issue

Currently, there're some issues when using the plugin inside Neovim on Windows and cannot be always reproduced:

Please try to turn on/off the async_switch_im and see if it helps.

Because I don't use Neovim on Windows, so if anyone would like to help debug and fix this issue, pull request is very welcome.