Skip to content

A simple neovim plugin to automatically switch input method (only support macOS now).

License

Notifications You must be signed in to change notification settings

wangl-cc/im-switch.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IM-Switch.nvim

A simple neovim plugin to automatically switch input method (only support macOS now).

Features

  • Automatically switch input method when entering/leaving insert mode.
  • File patterns to enable IM switching only in specific files.
  • Support different IM in different buffers.
  • Async, no blocking.
  • Manually toggle IM switching by :IMSwitch command.

Installation

Use your favorite plugin manager, for example, with lazy.nvim:

{
  'wangl-cc/im-switch',
  dependencies = { "nvim-lua/plenary.nvim" },
  event = "BufWinEnter",
  opts = {},
}

If you only enable IM switching manually, you can lazy load it by cmd:

{
  'wangl-cc/im-switch',
  dependencies = { "nvim-lua/plenary.nvim" },
  cmd = "IMSwitch",
  opts = {
    filter = false,
  },
}

Options

{
  normal_im = "com.apple.keylayout.ABC", -- IM to switch in normal mode
  -- Filter to decide which buffer to enable IM switching
  -- Set filter to false to don't enable IM switching automatically
  -- Set filter to true to enable IM switching in all buffers
  filter = {
    -- File patterns to enable IM switching
    pattern = { "*.md", "*.txt" },
    -- Buffer options to enable IM switching
    -- each option can be a value or a list of values
    bo = {
      readonly = false,
      buftype = "",
    },
  },
  -- Whether to create `IMSwitch` command
  command = true,
}

Thanks

About

A simple neovim plugin to automatically switch input method (only support macOS now).

Resources

License

Stars

Watchers

Forks