Rime

出自 Arch Linux 中文维基

Rime(中州韻輸入法引擎)是一款支持多種輸入方案的輸入法引擎。

Rime 本身沒有用於處理用戶輸入的前端,需要配合輸入法框架才能使用,比如 Fcitx5IBus

安裝[編輯 | 編輯原始碼]

分別安裝提供 Rime 輸入引擎的 librime 和所使用輸入法對應的集成:

配置[編輯 | 編輯原始碼]

Rime 需要輸入方案才能工作,用戶可以定製輸入方案,也可以使用軟件倉庫中的一些官方輸入方案:

有些輸入方式會默認同 librime-data 元軟件包一同安裝,librime 也依賴此元軟件包。

使用 Rime 時,默認可以按 F4Ctrl+` 切換輸入法,詳見#選擇輸入方案

配置目錄[編輯 | 編輯原始碼]

若要自定義 Rime,請先根據使用的輸入法創建 Rime 的配置文件夾:

若使用 ibus-rime

$ mkdir ~/.config/ibus/rime

若使用 fcitx-rime

$ mkdir ~/.config/fcitx/rime/

若使用 fcitx5-rime

$ mkdir ~/.local/share/fcitx5/rime/

在文件夾中創建 default.custom.yaml 文件,以指定可選的輸入法。例如,若要按聲調輸入拼音,添加下列內容以使用地球拼音:

default.custom.yaml
patch:
  schema_list:
    - schema: terra_pinyin

添加內容時請注意行首縮進。此文件會覆蓋默認的配置文件,若只在文件中添加地球拼音,則只能用地球拼音。

應用配置[編輯 | 編輯原始碼]

請重新部署輸入法以使自定義生效。如果使用圖形界面的 IBus 或 Fcitx,請點擊 ⟲(重新部署)按鈕。也可以使用命令行重新部署:

若使用 ibus-rime

$ rm ~/.config/ibus/rime/default.yaml && ibus-daemon -drx

若使用 fcitx-rime

$ rm ~/.config/fcitx/rime/default.yaml && fcitx-remote -r

若使用 fcitx5-rime:

$ rm ~/.local/share/fcitx5/rime/default.yaml && fcitx5-remote -r

聲調過濾[編輯 | 編輯原始碼]

注意:可以選擇聲調以過濾候選列表,對應按鍵如下:

一声: -
二声: /
三声: <
四声: \

例如,若要打出拼音為 hǎo 的字,輸入 hao< 即可。

候選項個數[編輯 | 編輯原始碼]

Rime 默認只會列出 5 個候選項,可以修改 "menu/page_size" 的值以改變列出候選項的數量:

default.custom.yaml
patch:
     "menu/page_size": 9

使用[編輯 | 編輯原始碼]

選擇輸入方案[編輯 | 編輯原始碼]

使用 Rime 時,默認可以按 F4Ctrl+` 調整基礎設置。顯示的設置項如下:

1. 输入法名称
2. 中文 -› 西文
3. 全角 -› 半角
4. 漢字 -› 汉字
...

第一項會顯示輸入方案的名稱,可以在其中切換已啟用的不同輸入方案。

第二項可以切換中文/英文輸入。

第三項可以切換全形/半角標點。

第四項可以切換簡體/繁體輸入。

其他選項取決於當前使用的輸入方案。

自定義輸入方案[編輯 | 編輯原始碼]

通過覆蓋某一輸入方案的默認選項,可以不用每次打開菜單。

這需要創建一個 custom 文件(定製文件)來覆蓋 scheme 文件(方案定義)中的選項。

例子[編輯 | 編輯原始碼]

下文以更改地球拼音的默認選項從「繁體中文」到「簡體中文」為例。

該輸入方案由 rime-terra-pinyin/usr/share/rime-data/build/terra_pinyin.schema.yaml 提供。

根據輸入方案定義裡的 switches 段:

switches:
  - name: ascii_mode
    reset: 0
    states: ["中文", "西文"]
  - name: full_shape
    states: ["半角", "全形"]
  - name: simplification
    states: ["漢字", ]
  - name: ascii_punct
    states: ["。,", ".,"]

這一段是地球拼音所提供的選項菜單(由 F4 或者 Ctrl+` 打開)。對於不同的輸入方案,配置文件可能會有所不同。

在 Rime 的 #配置目錄 中,創建地球拼音的定製文件:

terra_pinyin.custom.yaml
patch:
  switches:
    - name: simplification
      reset: 1

name 項匹配方案定義中的 switches 列表的對應選項。 reset: 1 指 Rime 總是會重設該項為第二個選項 (下標 1,即 "漢字").

#應用配置 以加載定製文件。

Rime 提供了多種通過 YAML 來進行此類自定義的方法,更多案例可在 #進階內容 查看。

中文標點[編輯 | 編輯原始碼]

按下列各鍵輸入不同的符號:

[ -> 「 【 〔 [
] -> 」 】 〕 ]
{ -> 『 〖 {
} -> 』 〗 }
< -> 《 〈 « ‹
> -> 》 〉 » ›
@ -> @ @ ☯
/ -> / / ÷
* -> * * ・ × ※
% -> % % ° ℃
$ -> ¥ $ € £ ¥
| -> ・ | | § ¦
_ -> ——
\ -> 、 \ \
^ -> ……
~ -> 〜 ~ ~ 〰

進階內容[編輯 | 編輯原始碼]

若要查看詳細的 Rime 定製指南,見 https://github.com/rime/home/wiki/CustomizationGuide

疑難解答[編輯 | 編輯原始碼]

GNOME 環境下,ibus-setup 無法更改候選方向[編輯 | 編輯原始碼]

issue #52。 創建 ~/.config/ibus/rime/build/ibus_rime.yaml 並寫入以下內容:

style:
  horizontal: true

技巧[編輯 | 編輯原始碼]

輸入希臘字母[編輯 | 編輯原始碼]

若想輸入希臘字母,請在 luna_pinyin.custom.yaml 或自定義輸入方案文件中追加以下內容:

luna_pinyin.custom.yaml
recognizer:
  patterns:
    # Use / as the identifier here
    # You can freely replace your favorite identifiers (such as: `~, .\; etc., characters that need not be displayed directly on the screen)
    # Replace the / before the Greek letter at the same time
    punct: "^/([0-9]0?|[A-Za-z]+)$"
punctuator:
  symbols:
    # Here, the letter name is used as the code of the Greek letter, and you can replace it with your favorite code as needed.
    # For example, if you want to use a as the alpha code
    # just replace the alpha below with a
    "/alpha": ["Α", "α"]
    "/beta": ["Β", "β"]
    "/gamma": ["Γ", "γ"]
    "/delta": ["Δ", "δ"]
    "/epsilon": ["Ε", "ε"]
    "/zeta": ["Ζ", "ζ"]
    "/eta": ["Η", "η"]
    "/theta": ["Θ", "θ"]
    "/iota": ["Ι", "ι"]
    "/kappa": ["Κ", "κ"]
    "/lambda": ["Λ", "λ"]
    "/mu": ["Μ", "μ"]
    "/nu": ["Ν", "ν"]
    "/xi": ["Ξ", "ξ"]
    "/omicron": ["Ο", "ο"]
    "/pi": ["Π", "π"]
    "/rho": ["Ρ","ρ"]
    "/sigma": ["Σ", "σ", "ς"]
    "/tau": ["Τ", "τ"]
    "/upsilon": ["Υ", "υ"]
    "/phi": ["Φ", "φ"]
    "/chi": ["Χ", "χ"]
    "/psi": ["Ψ", "ψ"]
    "/omega": ["Ω", "ω"]

在此輸入配置下,輸入 /alpha 即會出現候選詞 α

另見[編輯 | 編輯原始碼]