https://github.com/qiumix/rime-toggle.nvim
Auto toggle ASCII mode of Rime with fcitx5 in Neovim, through D-Bus. 利用D-Bus在Neovim中自动切换中英文输入法状态。
https://github.com/qiumix/rime-toggle.nvim
dbus fcitx5 inputmethod linux neovim plugin rime vim
Last synced: 14 days ago
JSON representation
Auto toggle ASCII mode of Rime with fcitx5 in Neovim, through D-Bus. 利用D-Bus在Neovim中自动切换中英文输入法状态。
- Host: GitHub
- URL: https://github.com/qiumix/rime-toggle.nvim
- Owner: Qiumix
- Created: 2026-02-14T09:53:07.000Z (21 days ago)
- Default Branch: master
- Last Pushed: 2026-02-20T06:30:15.000Z (15 days ago)
- Last Synced: 2026-02-20T11:24:24.341Z (15 days ago)
- Topics: dbus, fcitx5, inputmethod, linux, neovim, plugin, rime, vim
- Language: Lua
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rime-toggle.nvim
[English](README_en.md) | 简体中文
通过 D-Bus 在 Neovim 中自动切换 fcitx5 Rime 输入法的 ASCII 模式。
## 功能特性
- 离开插入模式时自动切换 Rime 到 ASCII 模式
- 进入插入模式时恢复之前的输入状态
- 通过 D-Bus 与 fcitx5 通信
- 开箱即用,无需配置
## 系统要求
- 支持systemd(比如linux和bsd)
- 安装了 Rime 输入法的 fcitx5
- `busctl` 命令(通常来自 systemd 软件包)
## 安装
使用 [lazy.nvim](https://github.com/folke/lazy.nvim):
```lua
{
"rime-toggle.nvim",
event = "InsertEnter",
-- 以下是默认值
-- enabled表示默认启用
-- smart_esc启用后,按Esc会在normal和visual模式下
-- 先强制转ASCII模式再发送Esc按键事件
-- opts = {
-- enabled = true,
-- smart_esc = true
-- }
}
```
使用 Neovim 内置包管理器(neovim 0.12加入,需要使用nightly版本):
```lua
vim.pack.add({
{ src = "https://github.com/Qiumix/rime-toggle.nvim") },
})
require('rime_dbus').setup({
-- enabled = true,
-- smart_esc = true
})
```
## 命令
- RimeEnable: 启用
- RimeDisablea: 禁用
- RimeToggle: 切换
## 建议
在配置文件 `~/.config/fcitx5/conf/rime.conf` 里添加下面这个选项
```conf
# 禁用多窗口rime状态共享
InputState=No
```
## 工作原理
当离开插入模式时,插件会:
1. 通过 D-Bus 查询当前 Rime 输入状态
2. 在内部保存该状态
3. 如果当前是中文模式,则切换到 ASCII 模式
当再次进入插入模式时,插件会:
1. 查询当前状态
2. 如果与之前保存的状态不同,则恢复之前的状态
这样可以确保在 Neovim 中以 ASCII 模式浏览和操作,同时在编辑时保持你偏好的输入状态。