Manjusaka

Manjusaka

Simple Recommendation for Rime Input Method

Sigh, recently I was hospitalized due to a pneumothorax during the New Year, feeling down for a long time during the Spring Festival. Today I'm heading back to Beijing, so I thought I'd recommend an input method—Rime.

Random Thoughts#

Like most people, I used to rely on Sogou Input Method as my main input tool, but some flaws in Sogou made me abandon it.

  1. As a traditional skill, Sogou Input Method's privacy protection is questionable. In certain versions on MacOS, Sogou sought to obtain my contacts and calendar reading permissions.

  2. As a traditional skill, the ad push from Sogou Input Method is really hard to describe, especially on Windows. I've already disabled some components, but it's still hard to guard against.

  3. Due to the need for communication with friends from Hong Kong, Macau, Taiwan, and abroad, I need an input method that supports Traditional Chinese well, and Sogou's support for Traditional Chinese is also hard to describe.

  4. The customization capabilities of Sogou Input Method really do not meet my needs.

Therefore, starting in 2018, I began looking for an open-source, controllable, customizable input method that is friendly to both Simplified and Traditional input. After some searching, Rime Input Method came into my view, and after more than a year of use, I think it is truly an excellent input method.

What is Rime?#

Rime (also known as 中州韻) is an open-source, cross-platform input method engine that is completely open-source and fully customizable. You can even package your own input method engine based on the Rime source code. Due to Rime's extremely high customizability, you can create your own input method based on Rime.

The main advantage of Rime lies in its excellent support for extensions through configuration files, and its support for Traditional Chinese is outstanding.

For example:

Excellent Support for Traditional Chinese

Here, "才" and "纔" are different. There are many more examples that you can experience for yourself.

However, Rime's great customizability can also be a drawback; for users, the pure YAML configuration file customization method has a high entry barrier.

Making Your Rime More Usable#

First, here are the effects of my Rime configuration:

image

image

image

image

image

image

Alright, let's talk about how to install and configure Rime.

Basic Installation of Rime#

There's not much to say; just download the installation package for your platform from the official website and install it. On MacOS, Rime's configuration is located in ~/Library/Rime. You can open the corresponding directory with a text editor like VSCode for editing.

The official recommendation is not to modify the original configuration files directly, as input method updates will overwrite the default configuration, which may lead to the loss of some custom configurations. The recommended approach is to create a series of patch configurations to implement seamless addition of custom configurations.

Rime Color Scheme#

The color management file for Rime is squirrel.custom.yaml. I personally use the Jike Yellow color scheme contributed by a user.

To switch the skin color, simply modify style/color_scheme to the corresponding skin color name.

patch:
  app_options:
    "com.runningwithcrayons.Alfred-3":
      ascii_mode: true
    com.google.android.studio:
      ascii_mode: true
    com.jetbrains.intellij:
      ascii_mode: true

  show_notifications_when: appropriate # Status notifications: appropriate (appropriate), on (always), off (never)

  style:
    color_scheme: jike
  preset_color_schemes:
    apathy:
      name: "Apathy"
      author: "LIANG Hai"
      horizontal: true # Horizontal arrangement
      inline_preedit: true # Single line display, false for double line display
      candidate_format: "%c\u2005%@\u2005" # Number %c and candidate word %@ spacing
      corner_radius: 5 # Candidate bar corner radius
      border_height: 0
      border_width: 0
      back_color: 0xFFFFFF # Candidate bar background color
      font_face: "PingFangSC-Regular,HanaMinB" # Candidate word font
      font_point: 16 # Candidate word size
      text_color: 0x424242 # Highlighted selected word color
      label_font_face: "STHeitiSC-Light" # Candidate word number font
      label_font_point: 12 # Candidate number size
      hilited_candidate_text_color: 0xEE6E00 # Candidate text color
      hilited_candidate_back_color: 0xFFF0E4 # Candidate text background color
      comment_text_color: 0x999999 # Pinyin and other prompt text color
    jike:
      name: Jike Yellow
      author: Ryekee
      back_color: 0x11E4FF
      corner_radius: 5 # Candidate bar corner radius
      border_height: 0
      border_width: 0
      candidate_format: "%c\u2005%@\u2005"
      candidate_text_color: 0x362915
      comment_text_color: 0x000000
      font_face: "PingFangSC-Regular,HanaMinB"
      font_point: 16 # Candidate word size
      hilited_candidate_back_color: 0xF4B95F
      hilited_candidate_text_color: 0xFFFFFF
      horizontal: true
      inline_preedit: true
      label_font_face: "STHeitiSC-Light"
      label_font_point: 12
      text_color: 0xFFFFFF

Rime Shortcut Characters#

In Rime, you can set some shortcuts to help input special characters and emojis. Many are included by default.

For example, typing /bg will give a list of Bagua patterns.

Bagua

For example, typing /xl will give a list of Greek characters.

Greek Characters

More shortcut inputs can be found in the list under symbols.yaml, and here are some fun ones to show you:

# Months, dates, days of the week, etc.
    '/yf': [ , , , , , , , , , , ,  ]
    '/rq': [ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,  ]
    '/yr': [ , , , , , , , , , , , , , , , , , , , , , , , , ,  ]
# Time
    '/sj': [ , , , , , , , , , , , , , , , , , , , , , , , ,  ]
# Heavenly Stems, Earthly Branches, Gan-Zhi
    '/tg': [ , , , , , , , , ,  ]
    '/dz': [ , , , , , , , , , , ,  ]
    '/gz': [ 甲子, 乙丑, 丙寅, 丁卯, 戊辰, 己巳, 庚午, 辛未, 壬申, 癸酉, 甲戌, 乙亥, 丙子, 丁丑, 戊寅, 己卯, 庚辰, 辛巳, 壬午, 癸未, 甲申, 乙酉, 丙戌, 丁亥, 戊子, 己丑, 庚寅, 辛卯, 壬辰, 癸巳, 甲午, 乙未, 丙申, 丁酉, 戊戌, 己亥, 庚子, 辛丑, 壬寅, 癸卯, 甲辰, 乙巳, 丙午, 丁未, 戊申, 己酉, 庚戌, 辛亥, 壬子, 癸丑, 甲寅, 乙卯, 丙辰, 丁巳, 戊午, 己未, 庚申, 辛酉, 壬戌, 癸亥 ]
# Solar Terms
    '/jq': [ 立春, 雨水, 驚蟄, 春分, 清明, 穀雨, 立夏, 小滿, 芒種, 夏至, 小暑, 大暑, 立秋, 處暑, 白露, 秋分, 寒露, 霜降, 立冬, 小雪, 大雪, 冬至, 小寒, 大寒 ]
# Units
    '/dw': [ Å, , , , , °, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,  ]
# Currency
    '/hb': [ , ¥, ¤, , , $, , £, , ฿, , , , , , , , , , , , , , , , , , , , , , , , , , , ,  ]

I referred to Moran’s configuration and added some settings in luna_pinyin_simp.custom.yaml.

  punctuator:
    import_preset: symbols
    symbols:
      "/fs": [½,,¼,,,¾,]
      "/dq": [🌍,🌎,🌏,🌐,🌑,🌒,🌓,🌔,🌕,🌖,🌗,🌘,🌙,🌚,🌛,🌜,🌝,🌞,,🌟,🌠,,,,🔥,💧,🌊]
      "/jt": [,,,,,,,,,,,,,,🔃,🔄,🔙,🔚,🔛,🔜,🔝]
      "/sg": [🍇,🍈,🍉,🍊,🍋,🍌,🍍,🍎,🍏,🍐,🍑,🍒,🍓,🍅,🍆,🌽,🍄,🌰,🍞,🍖,🍗,🍔,🍟,🍕,🍳,🍲,🍱,🍘,🍙,🍚,🍛,🍜,🍝,🍠,🍢,🍣,🍤,🍥,🍡,🍦,🍧,🍨,🍩,🍪,🎂,🍰,🍫,🍬,🍭,🍮,🍯,🍼,🍵,🍶,🍷,🍸,🍹,🍺,🍻,🍴]
      "/dw": [🙈,🙉,🙊,🐵,🐒,🐶,🐕,🐩,🐺,🐱,😺,😸,😹,😻,😼,😽,🙀,😿,😾,🐈,🐯,🐅,🐆,🐴,🐎,🐮,🐂,🐃,🐄,🐷,🐖,🐗,🐽,🐏,🐑,🐐,🐪,🐫,🐘,🐭,🐁,🐀,🐹,🐰,🐇,🐻,🐨,🐼,🐾,🐔,🐓,🐣,🐤,🐥,🐦,🐧,🐸,🐊,🐢,🐍,🐲,🐉,🐳,🐋,🐬,🐟,🐠,🐡,🐙,🐚,🐌,🐛,🐜,🐝,🐞,🦋]
      "/bq": [😀,😁,😂,😃,😄,😅,😆,😉,😊,😋,😎,😍,😘,😗,😙,😚,😇,😐,😑,😶,😏,😣,😥,😮,😯,😪,😫,😴,😌,😛,😜,😝,😒,😓,😔,😕,😲,😷,😖,😞,😟,😤,😢,😭,😦,😧,😨,😬,😰,😱,😳,😵,😡,😠]
      "/ss": [💪,👈,👉,👆,👇,,👌,👍,👎,,👊,👋,👏,👐]
      "/dn": [, , , , , , , , , ↩︎, , , , , , , , , ]
      "/fh": [©,®,,,,,,,,,,,,,,☑︎,,,,,,,,,,,]
      "/xh": [,×,,,,,,,,,,,,]

Setting the Input Method#

You can set your preferred input method in default.custom.yaml. I currently use Mingyue Pinyin, and the default shortcut for switching input methods is Ctrl+~, but since this shortcut conflicts with VSCode's shortcut, I changed it to Ctrl+Shift+F12.

patch:
  menu:
    page_size: 8
  schema_list:
  - schema: luna_pinyin_simp      # Mingyue Pinyin Simplified
  "switcher/hotkeys":
  - "Control+Shift+F12"

Tuning the Dictionary#

Here I quote Moran’s explanation:

The default dictionary of Rime is somewhat weak. We can download some Sogou dictionaries to expand it; however, the default format of Sogou dictionaries cannot be parsed. Fortunately, someone developed a tool that can conveniently convert Sogou cell dictionaries into Rime format (download the tool here). Currently, this tool only supports Windows (there are some other Python scripts written by others, but I haven't used them), so the dictionary conversion operation still requires a Windows virtual machine.
The conversion process is very simple: first, download a series of scel files from the Sogou dictionary, then select them in bulk, adjust the input and output formats, click convert, and finally save it as a txt file.
Having this text alone is not enough; we need to insert it into the dictionary's yaml configuration. So create a dictionary configuration file named luna_pinyin.sougou.dict.yaml, and write the header description (note to add a newline after the last three dots).

# Rime dictionary
# encoding: utf-8
# Sogou dictionary currently includes:
# IT computer practical IT vocabulary, relative titles, chemical names, digital time, mathematical vocabulary, Taobao vocabulary, programming languages, software specialties, color names, programmer vocabulary, development-specific vocabulary, Sogou standard vocabulary
# Photography terminology, computer professional vocabulary, comprehensive computer vocabulary, insurance vocabulary, the most detailed nationwide place name collection, food collection, common flower names, real estate vocabulary collection, traditional Chinese festival vocabulary collection, finance and economics vocabulary collection

---
name: luna_pinyin.sougou
version: "1.0"
sort: by_weight
use_preset_vocabulary: true
...

Next, just paste the content of the generated dictionary txt file under the three dots; however, if there are too many entries, you will find that this text can be dozens of MB, and most editors will freeze when opened. To solve this situation, just use the command line to cat it.

cat sougou.txt >> luna_pinyin.sougou.dict.yaml

Finally, modify the luna_pinyin.extended.dict.yaml file's import_tables field to include the newly created dictionary.

---
name: luna_pinyin.extended
version: "2016.06.26"
sort: by_weight  # Initial sorting of the dictionary, can choose original or by_weight
use_preset_vocabulary: true
# This is the basic extended vocabulary for Mingyue Pinyin, which links to the official Mingyue Pinyin dictionary, the extended vocabulary for Mingyue Pinyin (Chinese Dictionary), the extended vocabulary for Mingyue Pinyin (poetry), and the extended vocabulary for Mingyue Pinyin (including Western vocabulary). If you do not need to load a certain dictionary, please comment it out with "#".

import_tables:
  - luna_pinyin
  # Add Sogou dictionary
  - luna_pinyin.sougou
  - luna_pinyin.poetry
  - luna_pinyin.cn_en
  - luna_pinyin.kaomoji

In my configuration, I added medical, ancient poetry, military, and other dictionaries from Sogou (escape).

Shortcut Key Settings#

Here I referenced a Gist from the Rime author to configure some shortcut keys.

  ascii_composer/good_old_caps_lock: true
  ascii_composer/switch_key:
    Caps_Lock: commit_code
    Control_L: noop
    Control_R: noop
    # Pressing the left shift directly outputs English characters without needing to press enter again, keeping the input method in English mode.
    Shift_L: commit_code
    Shift_R: noop

Conclusion#

After all this tweaking, Rime should be able to meet our daily usage needs. The configurations mentioned in this article can be directly implemented using the configuration I have placed on GitHub for out-of-the-box use: RimeConfig.

Some may wonder why so much time is needed to tune an input method. Well, I believe that spending a certain amount of time to find something suitable for our daily tools and customizing it according to our needs is a very meaningful endeavor. In our subsequent work, life, and study, this will greatly enhance our happiness and efficiency.

Well, that's about it. This is the first article of the New Year. I wish everyone a Happy New Year!

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.