r/neovim • u/Dependent-Cover2532 • 17h ago
Plugin imselect.nvim – Your input method follows what you edit, not just your Vim mode
Hey r/neovim!
I'd like to share a plugin I've been working on: imselect.nvim.
As a Chinese speaker who also writes a lot of LaTeX, I often find myself switching between Chinese and ASCII several times without ever leaving Insert mode. Automatically switching to ASCII on Escape helps, but it only solves part of the problem.
So I built a plugin that takes both Vim modes and Tree-sitter syntax into account when switching input methods.
What it does:
- Switches between ASCII and your input method as you move between code, comments, strings, and prose, even within Insert mode.
- Handles LaTeX math environments, including text inside
\text{...}and snippet field jumps. - Restores your input method for
/and?searches while keeping:commands in ASCII. - Supports Linux, macOS, Windows, WSL, Neovide, and even remote Neovim sessions over SSH through Kitty.
There's also a small design detail that I'm particularly happy with.
The plugin doesn't continuously enforce an input method state. Instead, it switches when the editing context changes or when necessary at mode boundaries. This was originally a performance optimization to avoid unnecessary IME queries, but it had a nice side effect: you can manually switch your input method without the plugin fighting you.
For example, you can manually switch to Chinese inside a code region, continue typing and using completion, and the plugin will leave your choice alone until the context changes. Press Escape, and you're back in ASCII.
The demo shows a continuous LaTeX editing session with zero manual input method switches. It's recorded using a real Fcitx5/Rime input method, not simulated text input.
GitHub: https://github.com/dirichy/imselect.nvim
I'd love to hear how other multilingual Neovim users handle input method switching, especially those using Japanese, Korean, or input methods I haven't had a chance to test.
Feedback, bug reports, and suggestions are very welcome!


