132 points · by algon · 3y ago · 27 comments
A while ago, I came up with an idea: what if we could use Vim as an IME?
Ordinary IMEs are used to input some non-English characters, but the essential functions of IME are 1) receiving a keyboard sequence 2) process the key sequence and outputting a text
These functions are the same as text editor's. So I thought implementing an IME that can be used with Vim keybindings could be a good solution for the above problem.
After that I learned mechanisms of IME for Linux desktop and tried to develop an experimental IME.
Back in the '90s I had made an X Input Method that used vim -- essentially forked a gvim process on a temporary file and read the file upon termination. It was a nice learning experience, but not very useful.
Besides textareas in browsers (the main use, where a number of other solutions currently exist), a fun demo was to use vi for changing formulas in a spreadsheet (I assume it must have been StarOffice back then).
I don't daily-drive it though, mostly because I never found time to update rather limited set of keybindings, a task that seems way more involving than a couple of little fixes that were needed to support GTK3.
Q: Why not publish it to crates.io (cargo publish)?
Curious: Did you consider neovim over vim and if so what made you stick with vim? AAUI neovim has these kinds of "embedded" use-cases in mind and intends to be smoother than vanilla vim.
FYI, since this IME embeds a terminal emulator it should be able to use with other terminal-based editors (including Neovim) by applying almost no changes to the editor's codebase.
Thanks for sharing!