Skip to content

Neovim plugin that automatically switches your input method based on context, improving your writing experience in non-English languages.

License

Notifications You must be signed in to change notification settings

amekusa/auto-input-switch.nvim

Repository files navigation

English / 日本語


   ▀█▀██              ▀██▀                 ▄█▀▀▄█
   ▐▌ ██  █ █ ▀█▀ █▀▄  ██  █▀▄ █▀▄ █ █ ▀█▀ ██   █ █ █ █ █ ▀█▀ ▄▀▀ █ █
   █▄▄██  █ █  █  █ █  ██  █ █ █▄█ █ █  █   ▀▀▄▄  █ █ █ █  █  █   █▀█
  ▐▌  ██  ▀▄█  █  ▀▄█  ██  █ █ █   ▀▄█  █  █   ██ ▀▄█▄█ █  █  ▀▄▄ █ █
 ▄█▄ ▄██▄ ━━━━━━━━━━━ ▄██▄ ━━━━━━━━━━━━━━━ █▀▄▄█▀ ━━━━━━━━━━━━━━━━━━ ★ NVIM

GitHub Tag

Demo Gif

A Neovim plugin that automatically switches your input method (IME / input source) based on context.
It removes the friction of constantly toggling between English and non-English input methods when coding, writing, or taking notes.

Works on macOS, Windows, and Linux.

Warning

Breaking changes in v5.0.0
If you’re upgrading from v4.x or earlier, please check the Changelog for details.

Features

  • Normalize:
    Always return to Latin input (e.g. US keyboard) outside of Insert mode.
  • Restore:
    When you return to Insert mode, restore the input method you were using last time.
  • Match:
    Detect nearby text and automatically switch to the matching input method (Japanese, Chinese, Korean, Russian, …).
  • Popup notifications:
    Show a small popup whenever the plugin switches your input method.

Installation

With lazy.nvim:

require('lazy').setup({
  {
    'amekusa/auto-input-switch.nvim',
    config = function()
      require('auto-input-switch').setup({
        -- your options
      })
    end
  },
})

Configuration

This plugin is highly configurable.
For all available options, see:

Example: enable Match for Japanese, Chinese, and Korean:

require('auto-input-switch').setup({
  match = {
    enable = true,
    languages = {
      Ja = { enable = true, priority = 1 },
      Zh = { enable = true, priority = 0 },
      Ko = { enable = true },
    }
  },
  restore = {
    enable = false,
      -- If you enable Match, it is recommended
      -- to disable Restore to avoid confusion.
  },
})

Note

Since Japanese and Chinese share some Unicode ranges, it’s recommended to set priority to control which language takes precedence.

Requirements

  • Neovim: v0.10+
  • OS: macOS, Windows, Linux

You need a commanline program to switch input methods in the background.
With the default config:

Documents

Changelog

v5.2.0

Some default option values have been changed:

  • normalize.on
    • New default: { 'QuitPre' }
    • Old default: { 'BufLeave', 'WinLeave', 'FocusGained', 'ExitPre', 'QuitPre' }
  • restore.on
    • New default: nil
    • Old default: { 'FocusGained }
  • match.on
    • New default: nil
    • Old default: { 'FocusGained }

v5.1.0

Now Normalize, Restore, and Match work on the buffers without any filetype if normalize|restore|match.filetypes = '*'.

v5.0.0

This release includes major breaking changes.
If you’re upgrading, please review carefully.

Breaking Changes:

  • Replaced *.file_pattern with *.filetypes (takes filetype names, not extensions).
  • New *.on_mode_change options replace some InsertEnter/InsertLeave defaults.
  • restore.exclude_pattern now uses regex (not Lua patterns).
  • Popup window options moved from popup.*popup.window.*.

Non-breaking Changes:

  • popup.labels.* simplified (accepts plain strings).
  • New options: normalize.debounce, restore.debounce, match.debounce, *.buf_condition.
  • New buffer-local commands:
    • :AutoInputSwitchBuf on|off
    • :AutoInputSwitchBufNormalize on|off
    • :AutoInputSwitchBufRestore on|off
    • :AutoInputSwitchBufMatch on|off
Older releases:
  • v4.1.0 – Override cmd_set per input method
  • v4.0.0 – Custom popup labels, bug fixes
  • v3.0.0 – Added Match feature
  • v2.0.0 – Added async support
  • v1.0.0 – Initial release

License

MIT © 2025 Satoshi Soma

About

Neovim plugin that automatically switches your input method based on context, improving your writing experience in non-English languages.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors