Rime
Rime is an input method engine for entering Chinese characters, supporting a wide range of input methods.
The Rime engine itself does not provide a frontend for receiving user input. It must be used with an input method framework such as Fcitx5 or IBus.
Installation
Install the librime package containing the Rime engine, and the integration corresponding with your IMF:
- For Fcitx5, installfcitx5-rime.
- For Fcitx, install fcitx-rime.
- For IBus, install ibus-rime.
Configuration
In order for Rime to work, input schemas are needed. Schemas are text files that can be created and customized by users. By default, some schemas are installed with librime-data meta package as it is a dependency of librime.
Alternatively, there are several input schemas available in package repository:
- rime-luna-pinyin - 朙月拼音 Standard Mandarin
- rime-terra-pinyin - 地球拼音 Mandarin with tones
- rime-double-pinyin - Double pinyin input schemas, include 自然碼雙拼, Double pinyin ABC (智能ABC雙拼), Double pinyin FLYPY (小鶴雙拼), Double pinyin MSPY (MSPY雙拼) and Double pinyin PYJJ (拼音加加雙拼).
- rime-pinyin-simp - 袖珍简化字拼音 Simplified pinyin
- rime-cantonese - 粵語拼音 Cantonese pingjam
- rime-cangjie - 倉頡五代 Cangjie
- rime-quick - 速成 Quick
- rime-stroke - 五筆畫 Stroke
- rime-wubi - 五筆字型86 Wubi
- rime-wugniu - 上海吳語 wugniu
- rime-bopomofo - 注音 bopomofo
- rime-emoji - Emoji input
- rime-flypyAUR - 小鶴音形, a derivative of 小鶴雙拼
- rime-ice-gitAUR - 雾凇拼音, comes with a large dictionary and other smart functions
Some schema packages provide more than one schemas. For example, rime-luna-pinyin provides 5 schemas including luna_pinyin
and luna_pinyin_fluency
. You can check content of each package from Rime GitHub organization.
You can switch input schema at any time by pressing F4
to trigger the program menu. See #Selecting input method.
Configuration directory
To customize Rime, you should first create the Rime configuration directory. Assuming you are using ibus-rime:
$ mkdir ~/.config/ibus/rime
Or if you are using fcitx-rime:
$ mkdir ~/.config/fcitx/rime/
Or if you are using Fcitx5:
$ mkdir ~/.local/share/fcitx5/rime/
In this directory, create a file named default.custom.yaml
, where you specify your input schema of choice. For example, if you want to be able to type pinyin with tones, you can use the Terra Pinyin input method by adding it to the list of enabled schemas:
default.custom.yaml
patch: schema_list: - schema: terra_pinyin
The proper names for the installed rime
schemas can be found in:
~/.local/share/fcitx5/rime/build
Note that the indentation level is important. This file overrides the default configuration, so if you only add Terra Pinyin, it will be the only schema enabled.
Apply configuration
To make the customizations effective, you need to redeploy. If you have working IBus or Fcitx GUI, you may find a ⟲ (Deploy) button and click it. Alternatively, use the following command, assuming you are using ibus-rime:
$ rm ~/.config/ibus/rime/default.yaml && ibus-daemon -drx
Or if you are using fcitx-rime:
$ rm ~/.config/fcitx/rime/default.yaml && fcitx-remote -r
Or if you are using fcitx5-rime:
$ rm ~/.local/share/fcitx5/rime/default.yaml && fcitx5-remote -r
Tones
Specifying tones is optional but they are very useful for filtering the list:
1st tone: - 2nd tone: / 3rd tone: < 4th tone: \
For example, if one wants to type hǎo
to display only Chinese characters that are pronounced this way, one must type hao<
and it will be automatically converted to "hǎo".
Input candidates
By default, RIME only displays five candidates for input whilst typing. You can change this by setting the "menu/page_size"
value manually.
default.custom.yaml
patch: "menu/page_size": 9
Usage
Selecting input method
By default, while running Rime, you can access some basic options with F4
or Ctrl+`
. The displayed options look like this:
1. Method name 2. 中文 -› 西文 3. 全角 -› 半角 4. 漢字 -› 汉字 etc.
The first one indicates the name of the method you have selected (Ex: 地球拼音 for Terra Pinyin). If you have enabled multiple input methods, you can switch between them.
The other options depend on the current input method:
The second one lets you switch between Chinese and western languages.
The third one lets you select if you want to type the punctuation in full width (全角) or in half width (半角).
The last one allows you to switch between traditional Chinese (漢字) and simplified Chinese (汉字).
Configure input method
Rather than open the menu each time it's possible to override the default options of a particular input method. This requires creating a "custom" config file that modifies the "schema" of the input method.
Example
For example, to change the Terra Pinyin default from traditional Chinese to simplified Chinese:
The schema file installed for rime-terra-pinyin is /usr/share/rime-data/build/terra_pinyin.schema.yaml
. Refer to the switches
section in the schema file:
switches: - name: ascii_mode reset: 0 states: ["中文", "西文"] - name: full_shape states: ["半角", "全角"] - name: simplification states: ["漢字", ] - name: ascii_punct states: ["。,", ".,"]
These are the choices shown when Terra Pinyin is active and the options menu is opened with F4
or Ctrl+`
. For a different input method, the schema file will be different.
Create a custom config file for Terra Pinyin in your Rime #Configuration directory:
terra_pinyin.custom.yaml
patch: switches: - name: simplification reset: 1
name
matches the entry in the schema file switches
list. reset: 1
configure rime to always reset this item to the second choice (index 1, or "汉字"
).
#Apply configuration to load the customized config.
Rime provides multiple YAML syntax methods for this type of customization; see #Advanced for more examples.
Chinese punctuation
Chinese punctuation is typed like so:
[ -> 「 【 〔 [ ] -> 」 】 〕 ] { -> 『 〖 { } -> 』 〗 } < -> 《 〈 « ‹ > -> 》 〉 » › @ -> @ @ ☯ / -> / / ÷ * -> * * ・ × ※ % -> % % ° ℃ $ -> ¥ $ € £ ¥ | -> ・ | | § ¦ _ -> —— \ -> 、 \ \ ^ -> …… ~ -> 〜 ~ ~ 〰
Advanced
More advanced examples are provided on the project website (in Chinese).
Troubleshooting
ibus-setup set orientation invaild in GNOME environment
See issue #52. Create ~/.config/ibus/rime/build/ibus_rime.yaml
with follows:
style: horizontal: true
Tips and tricks
Greek letters
Greek characters can be typed by adding the following to luna_pinyin.custom.yaml
or a custom input scheme file:
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": ["Ω", "ω"]
For example, with this scheme, the character α
is produced by typing /alpha
.