Rime custom

1 About Rime

Rime is the best chinese input method that I have ever met. It can be customized according to my habits and perferred settings.

2 ibus-rime

2.1 installation

fcitx-rime is a better choice for vim users. But ibus-rime is more stable and updated.

sudo apt-get install ibus ibus-rime fcitx-rime

~/.config/ibus/rime is ibus-rime's default config file path. It's recommended to use *.custom.yaml to save user's own configuration instead of modifying default files.

2.2 issues

Run ibus-setup to set pannel and candidate preference, for ibus-rime having no permissions to modify ibus configuration.

If ibus-rime is missing in system tray, check /usr/share/ibus-rime/icons/zhung.svg. Copy it as zhung.png, then open and save as zhung.svg.

3 squirrel

MacOS version of rime is named squirrel, and with fcitx-remote-for-osx it become an amazing input-method.

3.1 squirrel.custom.yaml

patch:

# us_keyboard_layout: true
show_notifications_when: appropriate

## disable chinese character input as defaut
app_options/com.runningwithcrayons.Alfred-3:
ascii_mode: true
# app_options/org.gnu.Emacs :
# ascii_mode: true
app_options/com.tencent.qq: {}

## other color schemes aqua,azure,luna, ink, starcraft, solarized_rock, dark_temple
# style/color_scheme : lost_temple
# style/color_scheme : clean_white
style/color_scheme : google
style/horizontal : false
style/inline_preedit : false
style/corner_radius : 3
style/border_height : 4
style/border_width : 4
style/line_spacing : 1
style/spacing : 5
style/font_point : 20
style/font_face : "Hiragino Sans GB W3"

3.2 modified color scheme

patch:

  # us_keyboard_layout: true
  show_notifications_when: appropriate

  style:
    color_scheme: apathy

  preset_color_schemes:

    apathy:

      name: "冷漠 / Apathy"
      author: "LIANG Hai "

      horizontal: true  # 水平排列
      inline_preedit: true #单行显示,false 双行显示
      candidate_format: "%c\u2005%@\u2005"  # 用 1/6 em 空格 U+2005 来控制编号 %c 和候选词 %@ 前后的空间。

      corner_radius: 5  #候选条圆角
      border_height: 6                                   # 窗口边界高度,大于圆角半径才生效
      border_width: 6                                    # 窗口边界宽度,大于圆角半径才生效
      back_color: 0xFFFFFF  #候选条背景色
      border_color: 0xE0B693                             # 边框色
      font_face: ".AdobeSHSDeskSC-Regular"  #候选词字体
      font_point: 16  #候选字词大小
      text_color: 0x424242  #高亮选中词颜色
      label_font_face: "SourceCodePro-Regular"   #候选词编号字体
      label_font_point: 13   #候选编号大小
      label_color: 0x9e9e9e                              # 预选栏编号颜色
      candidate_text_color: 0x000000                     # 预选项文字颜色
      text_color: 0x9e9e9e                               # 拼音行文字颜色,24 位色值,16 进制,BGR 顺序
      comment_text_color: 0x999999                       # 拼音等提示文字颜色
      hilited_text_color: 0x9e9e9e                       # 高亮拼音 (需要开启内嵌编码)
      hilited_candidate_text_color: 0x000000             # 第一候选项文字颜色
      hilited_candidate_back_color: 0xfff0e4             # 第一候选项背景背景色
      hilited_candidate_label_color: 0x9e9e9e            # 第一候选项编号颜色
      hilited_comment_text_color: 0x9e9e9e               # 注解文字高亮

  "app_options/com.runningwithcrayons.Alfred-3/ascii_mode": true
  # "app_options/org.gnu.Emacs/ascii_mode": true

3.3 luna_pinyin.custom.yaml

# luna_pinyin.custom.yaml
#
# 補靪功能:將朙月拼音的詞庫修改爲朙月拼音擴充詞庫
#
# 作者:瑾昀 <cokunhui@gmail.com>
#
# 注意:本補靪適用於所有朙月拼音系列方案(「朙月拼音」、「朙月拼音·简化字」、「朙月拼音·臺灣正體」、「朙月拼音·語句流」)。
# 只須將本 custom.yaml 的前面名字改爲對應的輸入方案名字然後放入用戶文件夾重新部署即可。如 luna_pinyin_simp.custom.yaml。
# 雙拼用戶請使用 double_pinyin.custom.yaml。
#
# 附朙月拼音系列方案與其對應的 id 一覽表:
# 輸入方案 id
# 朙月拼音 luna_pinyin
# 朙月拼音·简化字 luna_pinyin_simp
# 朙月拼音·臺灣正體 luna_pinyin_tw
# 朙月拼音·語句流 luna_pinyin_fluency

patch:
switches:
- name: ascii_mode
reset: 0
states: ["中文", "西文"]
- name: full_shape
states: ["半角", "全角"]
- name: zh_simp # (※1) 繁简转换
reset: 1
states: ["漢字", "汉字"]
- name: ascii_punct
states: ["。,", ".,"]
# - options: ["utf8", "gbk", "gb2312"] # (※2)字符集选单
# reset: 0 # 默认 UTF8
# states:
# - UTF-8
# - GBK
# - GB2312
simplifier:
option_name: zh_simp

engine/filters:
- simplifier
- uniquifier
# - charset_filter@gbk # (※3) GBK 过滤
# 編譯版本的鼠鬚管可以去掉上面幾行的註釋符號,啓用字符集過濾功能

"speller/algebra/@before 0": xform/^([b-df-hj-np-tv-z])$/$1_/

# 加載 easy_en 依賴
"schema/dependencies/@next": easy_en
# 載入翻譯英文的碼表翻譯器,取名爲 english
"engine/translators/@next": table_translator@english
# english 翻譯器的設定項
english:
dictionary: easy_en
spelling_hints: 9
enable_completion: true
enable_sentence: true
initial_quality: 0

# 載入朙月拼音擴充詞庫
"translator/dictionary": luna_pinyin.extended

# 符号快速输入和部分符号的快速上屏
punctuator:
import_preset: symbols
symbols:
"/fs": [½, ‰, ¼, ⅓, ⅔, ¾, ]
"/bq": [😂️, 😅️, ☺️, 😱️, 😭️, 😇️, 🙃️, 🤔️, 💊️, 💯️, 👍️, 🙈️, 💩️, 😈️ ]
"/dn": [⌘, ⌥, ⇧, ⌃, ⎋, ⇪, , ⌫, ⌦, ↩︎, ⏎, ↑, ↓, ←, →, ↖, ↘, ⇟, ⇞]
"/fh": [ •, ♪, ©, ☭, ☮, ✠, ⚜, ⚛, ☤, ☯, ®, ℗, ℠, ™, ℡, ␡, ♂, ♀, ☉, ☊, ☋, ☌, ☍, ☐, ☑︎, ☒, ☜, ☝, ☞, ☟, ✎, ✄, ♲, ♻, ⚐, ⚑, ⚠]
"/xh": [ *, ×, ✱, ★, ☆, ✩, ✧, ❋, ❊, ❉, ❈, ❅, ✿, ✲]
half_shape:
"#": "#"
"*": "*"
"`": "`"
"~": "~"
"@": "@"
"=": "="
"/": ["/", "÷",]
'\': "、"
"_" : "──"
"'": {pair: ["「", "」"]}
"[": ["【", "["]
"]": ["】", "]"]
"$": ["¥", "$", "€", "£", "¢", "¤"]
"<": ["《", "〈", "«", "<"]
">": ["》", "〉", "»", ">"]
recognizer/patterns/punct: "^/([a-z]+|[0-9]0?)$"

# 模糊拼音
'speller/algebra':
- erase/^xx$/ # 第一行保留

# 模糊音定義
# 需要哪組就刪去行首的 # 號,單雙向任選
- derive/^([zcs])h/$1/ # zh, ch, sh => z, c, s
- derive/^([zcs])([^h])/$1h$2/ # z, c, s => zh, ch, sh

- derive/^n/l/ # n => l
- derive/^l/n/ # l => n

# 這兩組一般是單向的
#- derive/^r/l/ # r => l

#- derive/^ren/yin/ # ren => yin, reng => ying
#- derive/^r/y/ # r => y

# 下面 hu <=> f 這組寫法複雜一些,分情況討論
#- derive/^hu$/fu/ # hu => fu
#- derive/^hong$/feng/ # hong => feng
#- derive/^hu([in])$/fe$1/ # hui => fei, hun => fen
#- derive/^hu([ao])/f$1/ # hua => fa, ...

#- derive/^fu$/hu/ # fu => hu
#- derive/^feng$/hong/ # feng => hong
#- derive/^fe([in])$/hu$1/ # fei => hui, fen => hun
#- derive/^f([ao])/hu$1/ # fa => hua, ...

# 韻母部份
#- derive/^([bpmf])eng$/$1ong/ # meng = mong, ...
- derive/([ei])n$/$1ng/ # en => eng, in => ing
- derive/([ei])ng$/$1n/ # eng => en, ing => in

# 樣例足夠了,其他請自己總結……

# 模糊音定義先於簡拼定義,方可令簡拼支持以上模糊音
- abbrev/^([a-z]).+$/$1/ # 簡拼(首字母)
- abbrev/^([zcs]h).+$/$1/ # 簡拼(zh, ch, sh)

# 以下是一組容錯拼寫,《漢語拼音》方案以前者爲正
- derive/^([nl])ve$/$1ue/ # nve = nue, lve = lue
- derive/^([jqxy])u/$1v/ # ju = jv,
- derive/un$/uen/ # gun = guen,
- derive/ui$/uei/ # gui = guei,
- derive/iu$/iou/ # jiu = jiou,

# 自動糾正一些常見的按鍵錯誤
- derive/([aeiou])ng$/$1gn/ # dagn => dang
- derive/([dtngkhrzcs])o(u|ng)$/$1o/ # zho => zhong|zhou
- derive/ong$/on/ # zhonguo => zhong guo
- derive/ao$/oa/ # hoa => hao
- derive/ua$/au/ # shau => shua
- derive/([iu])a(o|ng?)$/a$1$2/ # tain => tian

# 分尖團後 v => ü 的改寫條件也要相應地擴充:
#'translator/preedit_format':
# - "xform/([nljqxyzcs])v/$1ü/"