Manjusaka

Manjusaka

Simple Recommendation for Rime Input Method

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

Random Thoughts#

Like most people, I previously used Sogou Input Method as my main input method, but some flaws in Sogou made me give it up.

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

  2. As a traditional skill, the ad push of Sogou Input Method is really hard to describe, especially on Windows. I've already blocked some components, but it still can't be completely prevented.

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

  4. The customization capability of Sogou Input Method really does not meet my needs.

Therefore, I started looking for an open-source, controllable, customizable input method that is friendly to both Simplified and Traditional input in 2018. After 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 advantages of Rime mainly lie in its excellent support for extensions through configuration files, and its support for Traditional Chinese is fantastic.

For example:

Excellent support for Traditional Chinese

Here, "才" and "纔" are different. There are many more examples for everyone to experience.

However, Rime's high customizability can also be a drawback. For users, the pure YAML configuration file customization method has a high entry threshold.

Making Your Rime More Usable#

First, let me show you the effect of my Rime configuration.

image

image

image

image

image

image

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

Basic Installation of Rime#

There's not much to say. Just download the installation package for the corresponding platform from the official website and install it. On MacOS, the configuration for Rime 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 directly modify the original configuration files, as the 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 a 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 netizen.

To switch the skin color scheme, simply modify style/color_scheme to the corresponding skin color scheme 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" # Space before and after number %c and candidate word %@ 
      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 shortcuts can be found in the list under symbols.yaml, and here are some fun ones for everyone to see.

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

I also referenced Moran's configuration and added some configurations 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 key to switch 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 Lexicon#

Here I quote Moran's explanation:

The default lexicon of Rime is a bit weak, and we can download some Sogou lexicons to expand it. However, the default format of Sogou lexicons cannot be parsed. Fortunately, someone has developed a tool that can conveniently convert Sogou cell lexicons into Rime format (click here to download the tool). Currently, this tool only supports Windows (there are also some Python scripts written by others, but I haven't used them), so lexicon conversion still requires a Windows virtual machine.
The conversion process is very simple. First, download a series of scel files from the Sogou lexicon, then select them in bulk, adjust the input and output formats, click convert, and finally save it as a txt file.
Having this text is not enough; we need to insert it into the lexicon's yaml configuration. So create a lexicon configuration file 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 lexicon currently includes:
# IT computer, practical IT vocabulary, relative titles, chemical names, numerical time, mathematical vocabulary, Taobao lexicon, programming languages, software specialties, color names, programmer lexicon, development-specific lexicon, Sogou standard lexicon
# Photography professional terms, computer professional lexicon, comprehensive computer vocabulary, insurance vocabulary, the most detailed nationwide place name collection, food collection, common flower names, real estate vocabulary collection, collection of traditional Chinese festivals, collection of financial and economic vocabulary

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

Next, just paste the content of the generated lexicon txt file under the three dots. However, if there are too many lexicons, 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 lexicon.

---
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 Mingyue Pinyin extended lexicon (basic) that defaults to loading the lexicons linked to Mingyue Pinyin, including the official lexicon, extended lexicon (Chinese Dictionary), extended lexicon (poetry), extended lexicon (including Western vocabulary). If you do not need to load a certain lexicon, please comment it out with "#".

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

In my configuration, I added lexicons from Sogou for medicine, ancient poetry, military, etc. (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 this series of tweaks, Rime should be able to meet our daily usage needs. The configurations 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 what suits us for basic tools we use daily and customizing them according to our needs is a very meaningful thing. In future 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.