logo科技微讯

在 macOS 使用粵語拼音輸入法 Rime

作者:科技微讯
日期:2023-02-22
📝 笔记

虽然 macOS、iOS 自带输入法已经支持粤语拼音,但它打出的是繁体字,而我希望输入简体字,所以最后还是继续用回 Rime。Rime 有一定的使用门槛,这里记录安装和配置方法。

  • 官网下载输入法并安装,也可以前往 Github 下载;
  • 打开用户设定文件夹;
  • 创建 default.custom.yaml 文件,复制以下内容到这个文件:
patch:
  # 每页候选词字数
  menu:
    page_size: 9
  # 仅保留粤语拼音输入法,其他删除
  schema_list:
    - schema: jyut6ping3
  # 更该翻页快捷键,参考:https://gist.github.com/lotem/2316704
  "key_binder/bindings":
    - { when: paging, accept: bracketleft, send: Page_Up }
    - { when: has_menu, accept: bracketright, send: Page_Down }
  • 创建 squirrel.custom.yaml 文件,复制以下内容到这个文件:
patch:
  # 删除 app_options 下的所有内容
  app_options:
  # 修改字体大小
  "style/font_point":
    18
  "style/comment_font_point":
    13
  "style/label_font_point":
    13
  • 创建 jyut6ping3.custom.yaml 文件,复制以下内容到这个文件:
patch:
  # 以下内容复制自 jyut6ping3.schema.yaml,但删除了 ascii_composer
  "engine/processors":
    - recognizer
    - key_binder
    - speller
    - punctuator
    - selector
    - navigator
    - express_editor
  # 以下内容复制自 jyut6ping3.schema.yaml,但把默认中文从繁体改为简体
  switches:
    - name: ascii_mode
      reset: 0
      states: ["中文", ABC]
    - name: full_shape
      states: ["半角", "全角"]
    - options: [noop, variants_hk, trad_tw, simplification]
      # 这里默认是 1,我改为 3
      reset: 3
      states: ["傳統漢字", "香港傳統漢字", "臺灣傳統漢字", "大陆简化汉字"]
    - name: ascii_punct
      states: ["。,", ".,"]
    - name: emoji_suggestion
      reset: 1
      states: ["冇 Emoji", "有 Emoji"]
  # 以下内容用于增加 emoji 输入,复制自:https://github.com/rime/rime-emoji/blob/master/emoji_suggestion.yaml
  switches/@next:
    name: emoji_suggestion
    reset: 1
    states: ["🈚︎", "🈶️"]
  "engine/filters/@before 0": simplifier@emoji_suggestion
  emoji_suggestion:
    opencc_config: emoji.json
    option_name: emoji_suggestion
    tips: none
    inherit_comment: false
  • 重新部署即可。

所创建的三个文件,其名称都带有 custom 字样,内容都以 patch 开头,这是鼠须管修改默认配置的方式,创建的三个文件分别修改了以下三个文件的默认配置:

  • default.yaml
  • squirrel.yaml
  • jyut6ping3.schema.yaml

重新部署时,custom 配置中的信息会覆盖或增加到对应的文件中,部署成功后,最终的配置信息都保存在用户设定文件夹中的 build 文件夹中。

之所以要删除 ascii_composer 且清空 app_options 中的内容,是因为鼠须管默认点击 shift 键切换英文,且当你从其他软件切换到 vscode 等编辑器时,输入法会从中文自动切换为英文,我不喜欢这样,有人建议表示删除以上两个配置信息即可禁用这两个功能。

2023-06-09 更新:对于 iOS,粤拼官网推荐 Jyutping,其实它也支持 macOS,开源,可输入简体字,内置学习资源,我没试它的 iOS 版,但 macOS 版有 bug,例如有时候完全无法输入文字,有时候无法输入标点,功能上也有所不足,例如不支持输入普通话拼音反查粤拼等,所以不太建议使用。

2023-06-30 更新:候选词中可能有乱码(俗称豆腐块),是因为鼠须管的词库比电脑系统的词库支持的汉字更多,不想显示豆腐块,就要想办法扩充电脑的词库,其中一个方法是下载并安装花園明朝词库,它几乎收录了所有汉字字形。

donation赞赏
thumbsup0
thumbsdown0
暂无评论