Rime: Difference between revisions

From ArchWiki
m (→‎Updating Defaults: change name of the heading)
(Reword last sentence to avoid "legacy" which feels weird + fix spelling)
 
(14 intermediate revisions by 7 users not shown)
Line 5: Line 5:


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]].
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]].
{{Note|[[Fcitx5]] and [[Fcitx]] are two different packages. Fcitx is in maintenance mode and people are advised to use Fcitx5 instead. Since 2021, the official page of [https://fcitx-im.org/ fcitx-im] points to Fcitx5. As the official packages have not renamed to reflect this change, pay a special attention to the sections below.}}


== Installation ==
== Installation ==


[[Install]] the {{Pkg|librime}} package containing the Rime engine, and the integration corresponding with your IMF:
[[Install]] the {{Pkg|librime}} package containing the Rime engine, and the integration corresponding with your IMF:
* For [[Fcitx5]], install{{Pkg|fcitx5-rime}}.
* For [[Fcitx5]], install{{Pkg|fcitx5-rime}}.
* For [[Fcitx]], install {{Pkg|fcitx-rime}}.
* For [[Fcitx]], install {{Pkg|fcitx-rime}}.
Line 15: Line 18:
== Configuration ==
== Configuration ==


In order for Rime to work, input schemas are needed. Schemas are text files that can be created and customized by users. Alternatively, there are several official input schemas available in package repository:
In order for Rime to work, input schemas are needed. Schemas are text files that can be created and customized by users. Alternatively, there are several input schemas available in package repository:


* {{Pkg|rime-luna-pinyin}} - 朙月拼音 Standard Mandarin
* {{Pkg|rime-luna-pinyin}} - 朙月拼音 Standard Mandarin
Line 29: Line 32:
* {{Pkg|rime-bopomofo}} - 注音 bopomofo
* {{Pkg|rime-bopomofo}} - 注音 bopomofo
* {{Pkg|rime-emoji}} - Emoji input
* {{Pkg|rime-emoji}} - Emoji input
* {{AUR|rime-flypy}} - 小鶴音形, a derivative of 小鶴雙拼
* {{AUR|rime-ice-git}} - [https://github.com/iDvel/rime-ice 雾凇拼音], comes with a large dictionary and other smart functions


By default, some schemas are installed with {{Pkg|librime-data}} meta package as it is a dependency of {{Pkg|librime}}.
By default, some schemas are installed with {{Pkg|librime-data}} meta package as it is a dependency of {{Pkg|librime}}.
Line 34: Line 39:
Some schema packages provide more than one schemas. For example, {{Pkg|rime-luna-pinyin}} provides 5 schemas including {{ic|luna_pinyin}} and {{ic|luna_pinyin_fluency}}. You can check content of each package from [https://github.com/rime Rime GitHub organization].
Some schema packages provide more than one schemas. For example, {{Pkg|rime-luna-pinyin}} provides 5 schemas including {{ic|luna_pinyin}} and {{ic|luna_pinyin_fluency}}. You can check content of each package from [https://github.com/rime Rime GitHub organization].


You can switch input schema at any time by pressing {{ic|F4}} to trigger the program menu. See [[#Selecting Input Method]].
You can switch input schema at any time by pressing {{ic|F4}} to trigger the program menu. See [[#Selecting input method]].


=== Configuration Directory ===
=== Configuration directory ===


To customize Rime, you should first create the Rime configuation directory. Assuming you are using {{Pkg|ibus-rime}}:
To customize Rime, you should first create the Rime configuration directory. Assuming you are using {{Pkg|ibus-rime}}:


  $ mkdir ~/.config/ibus/rime
  $ mkdir ~/.config/ibus/rime
Line 60: Line 65:
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.
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 ===
=== 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 {{Pkg|ibus-rime}}:
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 {{Pkg|ibus-rime}}:
Line 85: Line 90:
For example, if one wants to type {{ic|hǎo}} to display only Chinese characters that are pronounced this way, one must type {{ic|hao<}} and it will be automatically converted to "hǎo".
For example, if one wants to type {{ic|hǎo}} to display only Chinese characters that are pronounced this way, one must type {{ic|hao<}} and it will be automatically converted to "hǎo".


=== Input Candidates ===
=== Input candidates ===


By default, RIME only displays five candidates for input whilst typing. You can change this by setting the {{ic|"menu/page_size"}} value manually.
By default, RIME only displays five candidates for input whilst typing. You can change this by setting the {{ic|"menu/page_size"}} value manually.
Line 96: Line 101:
== Usage ==
== Usage ==


=== Selecting Input Method ===
=== Selecting input method ===


By default, while running Rime, you can access some basic options with {{ic|F4}} or {{ic|Ctrl+`}}. The displayed options look like this:
By default, while running Rime, you can access some basic options with {{ic|F4}} or {{ic|Ctrl+`}}. The displayed options look like this:
Line 115: Line 120:
The last one allows you to switch between traditional Chinese (漢字) and simplified Chinese (汉字).
The last one allows you to switch between traditional Chinese (漢字) and simplified Chinese (汉字).


=== Configure Input Method ===
=== 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.
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.
Line 140: Line 145:
These are the choices shown when Terra Pinyin is active and the options menu is opened with {{ic|F4}} or {{ic|Ctrl+`}}. For a different input method, the schema file will be different.
These are the choices shown when Terra Pinyin is active and the options menu is opened with {{ic|F4}} or {{ic|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]]:
Create a custom config file for Terra Pinyin in your Rime [[#Configuration directory]]:


{{hc|terra_pinyin.custom.yaml|
{{hc|terra_pinyin.custom.yaml|
Line 151: Line 156:
{{ic|name}} matches the entry in the schema file {{ic|switches}} list. {{ic|reset: 1}} configure rime to always reset this item to the second choice (index 1, or {{ic|"汉字"}}).
{{ic|name}} matches the entry in the schema file {{ic|switches}} list. {{ic|reset: 1}} configure rime to always reset this item to the second choice (index 1, or {{ic|"汉字"}}).


[[#Apply Configuration]] to load the customized config.
[[#Apply configuration]] to load the customized config.


Rime provides multiple YAML syntax methods for this type of customization, see [[#Advanced]] for more examples.
Rime provides multiple YAML syntax methods for this type of customization; see [[#Advanced]] for more examples.


=== Chinese punctuation ===
=== Chinese punctuation ===

Latest revision as of 07:46, 23 February 2024

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.

Note: Fcitx5 and Fcitx are two different packages. Fcitx is in maintenance mode and people are advised to use Fcitx5 instead. Since 2021, the official page of fcitx-im points to Fcitx5. As the official packages have not renamed to reflect this change, pay a special attention to the sections below.

Installation

Install the librime package containing the Rime engine, and the integration corresponding with your IMF:

Configuration

In order for Rime to work, input schemas are needed. Schemas are text files that can be created and customized by users. Alternatively, there are several input schemas available in package repository:

By default, some schemas are installed with librime-data meta package as it is a dependency of librime.

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

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.

See also