Loading... # Rime 输入法配置优化指南 # 一、概述 ## 1. 简介 ### A. 是什么 Rime(中州韵输入法引擎)是一款开源的跨平台输入法框架,支持多种拼音方案和自定义配置。本文介绍如何优化 Rime 配置,实现默认英文状态和简体输出。 ### B. 为什么需要优化 Rime 默认配置可能不符合个人使用习惯: - 默认处于中文状态,需要频繁切换 - 默认输出繁体字,需要手动转换 - 输入方案不是首选的明月拼音 ### C. 配置后效果 - 启动时默认处于英文状态 - 切换到中文后自动输出简体字 - 明月拼音为首选输入方案 ## 2. 前置知识 ### A. 必备条件 - 已安装 fcitx5-rime 或 ibus-rime - 具备基本的文本编辑能力 - 了解 YAML 配置文件格式 ### B. 相关概念 - 配置目录:用户自定义配置存放位置 - 构建目录:Rime 编译后的部署文件 - 覆盖机制:用户配置覆盖系统预设 # 二、配置目录结构 ## 1. 目录位置 不同平台的配置目录位置: | 平台 | 配置目录 | |------|---------| | fcitx5 | ~/.local/share/fcitx5/rime | | ibus | ~/.config/ibus/rime | | fcitx4 | ~/.config/fcitx/rime | ## 2. 配置文件说明 ```mermaid graph TB subgraph 配置目录 A[default.custom.yaml] B[luna_pinyin.custom.yaml] C[user.yaml] D[installation.yaml] end subgraph 构建目录 E[build/] E1[luna_pinyin.prism] E2[luna_pinyin_simp.prism] E3[default.yaml] end A -->|全局配置| E3 B -->|方案配置| E1 C -->|用户状态| E3 E -->|编译结果| F[输入法引擎] ```  # 三、配置文件详解 ## 1. default.custom.yaml 全局默认配置文件,控制输入方案列表和全局开关状态。 ```yaml patch: # 默认输入方案(第一个为默认) schema_list: - schema: luna_pinyin - schema: luna_pinyin_simp # 默认英文状态 switches: - name: ascii_mode reset: 1 states: [ 中文, 西文 ] ``` **配置说明**: - schema_list:输入方案列表,第一个为默认方案 - ascii_mode:中英文切换开关,reset=1 表示默认英文 - states:开关显示的文本 ## 2. luna_pinyin.custom.yaml 明月拼音方案的自定义配置,控制该方案的特定行为。 ```yaml patch: switches: - name: ascii_mode reset: 1 # 默认英文状态 states: [ 中文, 西文 ] - name: simplification reset: 1 # 开启简体字 states: [ 漢字, 汉字 ] ``` **配置说明**: - ascii_mode:方案级中英文开关,reset=1 表示默认英文 - simplification:繁简转换开关,reset=1 表示输出简体 ## 3. 开关对照表 | 开关名称 | reset=0 | reset=1 | 说明 | |---------|---------|---------|------| | ascii_mode | 中文 | 英文 | 中英文状态切换 | | simplification | 繁体 | 简体 | 繁简字输出 | | full_shape | 半角 | 全角 | 全角半角字符 | # 四、配置步骤 ## 1. 检查现有配置 ```bash # 查看配置目录 ls -la ~/.local/share/fcitx5/rime/ # 查看现有配置文件 cat ~/.local/share/fcitx5/rime/default.custom.yaml cat ~/.local/share/fcitx5/rime/user.yaml ``` ## 2. 创建配置文件 创建 luna_pinyin.custom.yaml 文件: ```bash # 创建文件 cat > ~/.local/share/fcitx5/rime/luna_pinyin.custom.yaml << 'EOF' patch: switches: - name: ascii_mode reset: 1 states: [ 中文, 西文 ] - name: simplification reset: 1 states: [ 漢字, 汉字 ] EOF ``` 更新 default.custom.yaml 文件: ```bash # 编辑文件 cat > ~/.local/share/fcitx5/rime/default.custom.yaml << 'EOF' patch: schema_list: - schema: luna_pinyin - schema: luna_pinyin_simp switches: - name: ascii_mode reset: 1 states: [ 中文, 西文 ] EOF ``` ## 3. 部署配置 ```bash # 清理构建缓存 rm -rf ~/.local/share/fcitx5/rime/build/* # 重启 fcitx5 触发重新部署 fcitx5-remote -r ``` **部署机制**:fcitx5-rime 检测配置变化后自动重新编译,生成可部署的二进制文件。 # 五、验证配置 ## 1. 检查配置文件 ```bash # 确认配置文件内容 cat ~/.local/share/fcitx5/rime/luna_pinyin.custom.yaml cat ~/.local/share/fcitx5/rime/default.custom.yaml ``` ## 2. 测试效果 | 测试项 | 预期结果 | |-------|---------| | 切换到 Rime | 默认显示「西文」 | | 输入拼音 | 输出简体汉字 | | 按 F4 切换方案 | 明月拼音排在第一位 | ## 3. 常见问题排查 **问题 1**:配置修改后不生效 - 检查 build 目录是否已清理 - 确认 YAML 语法正确(缩进使用空格) - 重启 fcitx5 **问题 2**:仍然输出繁体字 - 确认 simplification 开关的 reset 值为 1 - 检查是否选择了 luna_pinyin 而非 luna_pinyin_simp **问题 3**:默认仍是中文状态 - 同时修改 default.custom.yaml 和 luna_pinyin.custom.yaml - 确保 ascii_mode 的 reset 值为 1 # 六、进阶配置 ## 1. 添加快捷键 在 default.custom.yaml 中添加快捷键配置: ```yaml patch: switcher: hotkeys: - F4 save_options: - full_shape - simplification - ascii_punct ``` ## 2. 自定义词库 创建 custom_phrase.txt 文件: ```txt # 格式:词条\t权重\t编码 hello\thello Linux\tlinuxx ``` ## 3. 启用模糊拼音 创建 luna_pinyin.custom.yaml 添加: ```yaml patch: speller/algebra: - erase/^xx$/ # 模糊声母 - derive/([nl])v/$1ü/ # nü -> nv, lü -> lv ``` # 七、配置文件对照速查 ## 1. 文件功能对照 | 文件 | 作用范围 | 典型配置项 | |------|---------|-----------| | default.custom.yaml | 全局 | 方案列表、全局开关 | | luna_pinyin.custom.yaml | 单方案 | 方案开关、拼写规则 | | user.yaml | 用户状态 | 上次使用的方案 | | installation.yaml | 安装信息 | 已安装的方案列表 | ## 2. 常用开关值 | 场景 | ascii_mode | simplification | full_shape | |------|------------|----------------|------------| | 默认英文简体 | 1 | 1 | 0 | | 默认中文简体 | 0 | 1 | 0 | | 默认英文繁体 | 1 | 0 | 1 | # 八、参考资料 1. [Rime 官方文档](https://github.com/rime/librime/wiki) 2. [fcitx5-rime 配置指南](https://github.com/fcitx/fcitx5-rime) 3. [Rime 配置示例](https://github.com/lotem/rime-ice) 最后修改:2026 年 03 月 30 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏