Skip to content

Switch Input Method automatically depends on Neovim's edit mode

License

Notifications You must be signed in to change notification settings

guoang/im-select.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

im-select.nvim

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

This repo is forked from keaising/im-select.nvim, but has been refactored. New features:

  • use jobstart to select IM asynchronously.
  • auto select IM by both vim mode and file type.
  • toggle auto IM selection at runtime.

1. Install binary

Please install the executable im-select first.

Note: Putting binary into some path which Neovim can read from, you can detect it in Neovim by:

# Windows / WSL
:!which im-select.exe
# macOS
:!which im-select

2. Install plugin

Packer

use 'guoang/im-select.nvim'

Plug

Plug 'guoang/im-select.nvim'

3. Config

require("im_select").setup({
 -- IM will be used in `normal` mode
 -- For Windows/WSL, default: "1033", aka: English US Keyboard
 -- For macOS, default: "com.apple.keylayout.ABC", aka: US
 -- You can use `im-select` in cli to get the IM name of you preferred
 im_normal = "com.apple.keylayout.ABC",
 -- IM will be used in `normal` mode depend on **file type**
 im_normal_ft = {
   TelescopePrompt = "com.apple.keylayout.ABC",
 },
 -- IM will be used in `insert` mode
 im_insert = "com.apple.keylayout.ABC",
 -- IM will be used in `insert` mode depend on **file type**
 im_insert_ft = {
   TelescopePrompt = "com.apple.keylayout.ABC",
   markdown = "com.apple.inputmethod.SCIM.Shuangpin",
 },
 -- Create auto command to select `im_normal` when `InsertLeave`
 auto_select_normal = true,
 -- Create auto command to select `im_insert` when `InsertEnter`
 auto_select_insert = true,
 -- keymaps to toggle auto selection
   keymaps = {
     toggle_auto_select_normal = "",
     toggle_auto_select_insert = "",
   },
})

Im-select creates some auto-commands, use :autocmd im-select to inspect.

About

Switch Input Method automatically depends on Neovim's edit mode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%