Skip to content

Rime 输入法使用教程

首先,这是一篇输入法的技术配置文,如果对输入法没有什么特定需求的人完全没必要看。事实上, win11 上微软自带的输入法已经足够优秀了,足以满足 90% 以上的人群对输入法的需求。那么,既然已经有了这么一款自带的美观简洁合理的输入法,为什么我们还需要耗费大量时间去专门配置一款独属于自己的本地输入法呢?其中最大的原因也许是对于不同的人会有不同的审美与输入习惯。对我个人而言,在我对电脑系统进行大量的个性化配置与更改后,不知道是什么时候起系统自带的微软输入法会不稳定,时不时的出现打中文不显示选择框之类的怪问题,因此我会选择在本地配置一款个性化且美观好用的输入法,在多次选择后最终选定了 Rime 输入法。

一:Rime 输入法简介

image-20241231171229922

什么是 Rime?

中州韵输入法引擎(英语:Rime Input Method Engine,又称 Rime 输入法)是由佛振编写的开放源代码的中文输入法,目前项目网站、源代码均托管在 GitHub。基于同一个核心架构,该输入法分为三个官方发行版:Linux 发行版 中州韵(ibus-rime)、Windows 发行版 小狼毫(Weasel)、macOS 发行版 鼠须管(Squirrel)。另有数个第三方发行版:Linux 发行版 fcitx-rime、Windows 发行版 PRIME、macOS 发行版 XIME、Android 发行版 同文输入法(Trime)、iOS 发行版 iRime。Rime 输入方案贵在原创。不止于拼音、注音、仓颉、速成、五笔、双拼、宫保拼音、粤拼、吴语、中古汉语拼音、五笔画、Emoji、国际音标……

特性:

  • 定制词库

  • 定制输入选择 UI 界面

  • 定制不同输入法规则

  • 通过程序 YAML 文件与用户 YAML 文件控制整个使用过程

  • 流畅的繁简切换,全角半角切换,符号切换,输入方案切换

  • 支持图案,Latex 公式

  • ...

我最看重的点在于作为一款本地输入法:安全性高,简洁美观,个性化程度高,可以自己配置词库与颜文字,支持Latex。

小狼毫官方地址: https://github.com/rime/weasel

二:官方食用教程

配置 wiki 详细方案:https://github.com/rime/home/wiki/CustomizationGuide

三:个人配置方案

image-20250119134337483

鉴于 Rime 输入法的配置依赖于 yaml 配置文件,为用户开放了足够多的权限,可以自己配置词库,输入法等,这就为本地个人输入法的制作提供了可能。接下来我会基于我个人对本地输入法的配置撰写相应的文档。

下载野狼毫

https://www.123pan.com/s/c8zA-x85N3.html

  • weasel 程序文件夹: 用于放置野狼毫输入法的核心配置文件(一般不需要进行更改)
  • user 用户文件夹:供用户自己配置

使用野狼毫而非小狼毫的原因:野狼毫支持用户进行更多的配置且对原版有所限制的地方都开放给了用户,于我个人而言最重要的原因是输入法的圆角和左侧的那条竖线与 Win11 的风格更搭!

下载四叶草拼音输入方案

https://github.com/fkxxyz/rime-cloverpinyin

这是我使用下来认为最简洁最舒适的 Rime 输入法方案,而且在用久了之后输入法本身会通过词语使用频率自动适配个人输入习惯,属于是越用越好用的类型,这也是本地输入法的优势。

加入 Latex 语法输入方案(可选)

https://github.com/wklchris/Rime-latex-symbols

文件位置:D:\Rime\weasel-0.15.0\data\latexmath.yaml

输入法个性化配置:

weasel.custom.yaml:

yaml
customization:
  distribution_code_name: Weasel
  distribution_version: 0.9.29.1
  generator: "Weasel::UIStyleSettings"
  modified_time: "Wed Feb 12 09:16:25 2014"
  rime_version: 1.1

patch:

  # 以下软件默认英文模式
  "app_options/gvim.exe":
    ascii_mode: true
  "app_options/tcmatch64.exe":
    ascii_mode: true
  "app_options/totalcmd64.exe":
    ascii_mode: true
  "app_options/findandrunrobot.exe":
    ascii_mode: true

  # latex符号支持
  punctuator/import_preset: latexmath
  recognizer/patterns:
    punct: "^/([0-9]0?|[A-Za-z]+)$"

  # 以下修改皮肤
  "style/display_tray_icon": true
  "style/horizontal": true #横排显示
  "style/font_face": "Microsoft YaHei" #字体
  "style/font_point": 12 #字体大小
  "style/label_font_point": 12 #序号字体大小
  "style/comment_font_point": 12 #注释字体大小
  "style/inline_preedit": true # 嵌入式候选窗单行显示
  "style/color_font": true # 彩色字体
  "style/blur_window": true #亚克力

  "style/layout/border_width": 1
  "style/layout/border": 1
  "style/layout/margin_x": 12 #候选字左右边距
  "style/layout/margin_y": 12 #候选字上下边距
  "style/layout/hilite_padding": 12 #候选字背景色色块高度 若想候选字背景色块无边界填充候选框,仅需其高度和候选字上下边距一致即可
  "style/layout/hilite_spacing": 3 # 序号和候选字之间的间隔
  "style/layout/spacing": 10 #作用不明
  "style/layout/candidate_spacing": 12 # 候选字间隔
  "style/layout/round_corner": 12 #候选字背景色块圆角幅度
  "style/layout/corner_radius": 16 #候选框外圆角半径
  "style/layout/hilited_corner_radius": 12 #兼容鼠鬚管中高亮圓角參數 


  "style/color_scheme": mytheme
  preset_color_schemes:
    "Micosoft":
      name: "Micosoft"
      author: "XNOM"
      back_color: 0xffffff #候选框 背景色
      border_color: 0xD77800 #候选框 边框颜色
      text_color: 0x000000 #已选择字 文字颜色
      hilited_text_color: 0x000000 #已选择字右侧拼音 文字颜色
      hilited_back_color: 0xffffff #已选择字右侧拼音 背景色
      hilited_candidate_text_color: 0xffffff #候选字颜色
      hilited_candidate_back_color: 0xD77800 #候选字背景色
      candidate_text_color: 0x000000 #未候选字颜色

    "mytheme":
      name: "mytheme"
      author: puppet
      back_color: 0x0B0401
      border_color: 0x000000
      text_color: 0xACA49E
      hilited_text_color: 0xACA49E
      hilited_back_color: 0x241C18
      hilited_candidate_text_color: 0xC3E9F9
      # hilited_candidate_back_color: 0x22170C
      candidate_text_color: 0xB4ADA8
      comment_text_color: 0xB4ADA8
      hilited_mark_color: 0xFFBF00 # 标记颜色
    
    "win11dark":
      name: "Win11 暗色 / Win11 Dark"
      # color format, argb: 0xaarrggbb; rgba: 0xrrggbbaa
      color_format: rgba        # 也可以使用 argb
      border_color: 0x2C2C2CFF                      # 整体外边框颜色
      back_color: 0x2C2C2CFF                        # 整体底色
      hilited_candidate_back_color: 0x383838FF      # 选中项整体底色
      # hilited_candidate_border_color: 0x383838FF  # 选中项整体外边框颜色
      # candidate_back_color: 0x2C2C2CFF            # 候选项整体底色

      # hilited_back_color: 0x383838FF              # 选中拼音底色 (inline_preedit: false)
      hilited_text_color: 0x4CC2FFFF                # 选中拼音颜色 (inline_preedit: false)
      hilited_label_color: 0xDEDEDEFF               # 选中序号颜色
      hilited_candidate_text_color: 0xDEDEDEFF      # 选中文字颜色
      hilited_comment_text_color: 0xDEDEDEFF        # 选中注音颜色
      hilited_mark_color: 0x4CC2FFFF                # 标记颜色

      text_color: 0xFFFFFFFF               # 拼音颜色 (inline_preedit: false)
      label_color: 0xFFFFFFFF              # 序号颜色
      candidate_text_color: 0xFFFFFFFF     # 文字颜色
      comment_text_color: 0xFFFFFFFF       # 注音颜色
      shadow_color: 0x2C2C2CFF             # 阴影颜色

user.yaml:

yaml
var:
  last_build_time: 1729597559
  option:
    ascii_punct: true
    full_shape: false
    simplification: true
  previously_selected_schema: clover
  schema_access_time:
    clover: 1729440811
    luna_pinyin: 1729440799

clover.custom.yaml:

yaml
patch:
  'engine/translators/+':
    - lua_translator@date_translator
  punctuator/import_preset: latexmath
  recognizer/patterns:
    punct: "^/([0-9]0?|[A-Za-z]+)$"

default.custom.yaml:

yaml
customization:
  distribution_code_name: Weasel
  distribution_version: 0.15.0.0
  generator: "Rime::SwitcherSettings"
  modified_time: "Wed Jun 19 18:00:13 2024"
  rime_version: 1.9.0
patch:
  menu:
    page_size: 8
  schema_list:
    - {schema: clover}
    - {schema: luna_pinyin}
  "switcher/hotkeys":
    - F4

clover.schema.yaml:

eyaml
# Rime schema
# encoding: utf-8

schema:
  schema_id: clover
  name: 🍀️四叶草简体拼音
  version: "1.0.0"
  author:
    - fkxxyz - https://www.fkxxyz.com
  description: |
    由🍀️四叶草亲自定制,特点:
      1. 结合搜狗输入法的输入习惯
      2. 默认开启 emoji 表情支持
      3. 加上很多特殊符号的输入支持
      4. 繁简切换支持
      5. 许多智能纠错
  dependencies:
    - emoji

switches:
  - name: zh_simp_s2t
    reset: 0
    states: [ 简, 繁 ]
  - name: emoji_suggestion
    reset: 0
    states: [ "🈚️️\uFE0E", "🈶️️\uFE0F" ]
  - name: symbol_support
    reset: 1
    states: [ "无符", "符" ]
  - name: ascii_punct
    reset: 0
    states: [ 。,, ., ]
  - name: full_shape
    reset: 0
    states: [ 半, 全 ]
  - name: ascii_mode
    reset: 1
    states: [ 中, 英 ]

engine:
  processors:
    - ascii_composer
    - key_binder
    - speller
    - punctuator
    - selector
    - navigator
    - express_editor
  segmentors:
    - ascii_segmentor
    - matcher
    - abc_segmentor
    - punct_segmentor
    - fallback_segmentor
  translators:
    - punct_translator
    - script_translator
  filters:
    - simplifier@emoji_suggestion
    - simplifier@symbol_support
    - simplifier
    - uniquifier

simplifier:
  option_name: zh_simp_s2t
  opencc_config: s2t.json

emoji_suggestion:
  opencc_config: emoji.json
  option_name: emoji_suggestion
  tips: all

symbol_support:
  opencc_config: symbol.json
  option_name: symbol_support
  tips: all

speller:
  alphabet: zyxwvutsrqponmlkjihgfedcba
  delimiter: " '"
  algebra:
    # 基础
    - abbrev/^([a-z]).+$/$1/
    - abbrev/^([zcs]h).+$/$1/
    
    # 补全
    - derive/([dtngkhrzcs])o(u|ng)$/$1o/   # o = ou; o = ong
    - derive/ong$/on/      # on = ong
    - derive/^ding$/din/     # din = ding
    
    # 处理 v 和 u
    - derive/^([nl])ue$/$1ve/   # nve = nue; lve = lue
    - derive/^([jqxy])u/$1v/    # v = u; v = u
    
    # 智能纠错
    - derive/ao$/oa/       # oa = ao
    - derive/([iu])a(o|ng?)$/a$1$2/   # aio = iao; aing = iang; aung = uang
    - derive/([aeiou])ng$/$1gn/   # gn = ng
    - derive/un$/uen/    # uen = un
    - derive/ui$/uei/    # uei = ui
    - derive/iu$/iou/    # iou = ui
    - derive/tie$/tei/    # tei = tie
    - derive/i$/ii/      # ii = i  # i 不小心按两下
    - derive/u$/uu/      # ui = u  # u 不小心按两下

translator:
  dictionary: clover
  preedit_format:
    - xform/([nl])v/$1ü/
    - xform/([nl])ue/$1üe/
    - xform/([jqxy])v/$1u/

punctuator:
  import_preset: symbols
  full_shape:
    "`": "`"
    "~": "~"
    "!": "!"
    "@": "@"
    "#": "#"
    "$": "¥"
    "%": "%"
    "^": "……"
    "&": "&"
    "*": "×"
    "(": "("
    ")": ")"
    "_": "——"
    "+": "+"
    "-": "-"
    "=": "="
    "[": "【"
    "]": "】"
    "{": "{"
    "}": "}"
    "|": "|"
    "\\": "、"
    "/": ["、", "、", , "/", "÷"]
    ";": ";"
    "'": "‘"
    ",": ","
    ".": "。"
    "<": "《"
    ">": "》"
    "?": "?"
  half_shape:
    "`": "·"
    "~": "~"
    "!": "!"
    "@": "@"
    "#": "#"
    "$": "¥"
    "%": "%"
    "^": "……"
    "&": "&"
    "*": "×"
    "(": "("
    ")": ")"
    "_": "——"
    "+": "+"
    "-": "-"
    "=": "="
    "[": "【"
    "]": "】"
    "{": "{"
    "}": "}"
    "|": "|"
    "\\": "、"
    "/": ["、", "、", "/", "/", "÷"]
    ";": ";"
    "'": "’"
    ",": ","
    ".": "。"
    "<": "《"
    ">": "》"
    "?": "?"

key_binder:
  import_preset: default
  bindings:
    __patch:
      - key_bindings:/emacs_editing  # emacs 习惯
      - key_bindings:/move_by_word_with_tab  # tab 在单词间切换
      - key_bindings:/paging_with_minus_equal  # 减号等号翻页
      - key_bindings:/paging_with_comma_period   # 逗号句号翻页
      - key_bindings:/paging_with_brackets   # 中括号翻页
      - clover.key_bindings:/numbered_mode_switch   # Ctrl+Shift+数字 切换开关
      - clover.key_bindings:/windows_compatible_mode_switch   # Windows 兼容
      - clover.key_bindings:/kp_enter_is_return   # 小键盘回车设为普通回车

ascii_composer:
  import_preset: default
  good_old_caps_lock: true
  switch_key:
    Shift_L: commit_code   # 左 Shift 切换直接上屏字母
    Shift_R: commit_code   # 右 Shift 切换直接上屏字母
    Control_L: noop
    Control_R: noop
    Caps_Lock: noop
    Eisu_toggle: clear

此外,为更方便的输入当前日期,可以在user文件夹下新创建一个文件:

rime.lua:

lua
function date_translator(input, seg)
    if (input == "dd") then
       --- Candidate(type, start, end, text, comment)
       yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d"), ""))
       yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日"), ""))
    end
   if (input == "ww") then
      arr = {"一","二","三","四","五","六"}
      arr[0] = "日"
      yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d 星期"..arr[tonumber(os.date("%w"))]), ""))
   end
   if (input == "tt") then
      yield(Candidate("date", seg.start, seg._end, os.date("%Y-%m-%d %H:%M:%S"), ""))
      yield(Candidate("date", seg.start, seg._end, os.date("%H:%M:%S"), ""))
   end
 end
 
 --- 过滤器:单字在先
 function single_char_first_filter(input)
    local l = {}
    for cand in input:iter() do
       if (utf8.len(cand.text) == 1) then
          yield(cand)
       else
          table.insert(l, cand)
       end
    end
    for i, cand in ipairs(l) do
       yield(cand)
    end
 end

然后修改用户文件夹下的clover.custom.yaml(当前使用输入法的配置文件):

yaml
patch:
  'engine/translators/+': 
    - lua_translator@date_translator
  punctuator/import_preset: latexmath
  recognizer/patterns:
    punct: "^/([0-9]0?|[A-Za-z]+)$"

注:这个功能是在Issue中由使用者自发解决的,并不是官方提供的方法,但确实是非常的好用。

这是原讨论贴:https://github.com/rime/weasel/issues/63

上次更新于: