CREDIT: It is a fork from the brilliant keaising/im-select.nvim: Switch Input Method automatically depends on Neovim's edit mode. Since I change too much of it, So I make a new repo to develop it.
Automatically change input method for you, works for all platforms.
im-select.nvim
use external tools to switch IM, you need to:
- Install binary tools on different OS;
- Make sure the commands of get and set input commands works in the terminal first;
- Add im-select.nvim to your package manager config file;
For folke/lazy.nvim: 💤 A modern plugin manager for Neovim
{
"DeccanLin/im-select.nvim",
config = function()
require("im_select").setup({})
end,
}
use 'DeccanLin/cmake-tools.nvim'
For junegunn/vim-plug: 🌺 Minimalist Vim Plugin Manager
Plug 'DeccanLin/cmake-tools.nvim'
For different platforms with different input methods:
default_mode | get_mode_command | set_mode_command | |
---|---|---|---|
Windows | 1033 |
im-select.exe |
im-select.exe |
macOS | com.apple.keylayout.ABC |
im-select |
im-select |
Linux-Fcitx | -c |
fcitx-remote -o |
fcitx-remote |
Linux-Fcitx5 | keyboard-us |
fcitx5-remote -n |
fcitx5-remote |
Linux-IBUS | xkb:us::eng |
ibus engine |
ibus |
Linux-Linux-Fcitx5-Rime | b true |
busctl call --user org.fcitx.Fcitx5 /rime org.fcitx.Fcitx.Rime1 IsAsciiMode |
busctl call --user org.fcitx.Fcitx5 /rime org.fcitx.Fcitx.Rime1 SetAsciiMode |
Example
{
"keaising/im-select.nvim",
config = function()
require('im_select').setup({
-- Restore the default input method state when the following events are triggered
set_default_events = { "InsertLeave" },
-- Restore the previous used input method state when the following events are triggered
set_previous_events = { "InsertEnter" },
-- Async run `set_mode_command` to switch IM or not
async_switch_im = true,
-- Default params for set_mode_command
default_mode = "-c",
-- Command to get current input method mode
get_mode_command = "fcitx5-remote -n",
-- Command to set input method
set_mode_command = "fcitx5-remote",
})
end,
}
- Add help info;
- Add health check;