Note: this post is out of date, see http://wenshanren.org/?p=1076 for a non pyim solution.
The integration of pyim and rime is relatively experimental and the setup process is not straight-forward, hence I wrote this blog.
Install rime (Debian 10)
sudo apt-get install fcitx fcitx-rime sudo apt-get install librime-bin librime-dev librime1
Emacs Settings
Build liberime
git clone --depth=1 https://gitlab.com/liberime/liberime.git
then build it following its README
Build Emacs With Dynamic Module Support
To load the module built above, Emacs needs to be built with dynamic module support.
git clone --depth 1 https://github.com/emacs-mirror/emacs.git
cd emacs
./configure --with-modules
make
sudo make install
pyim Configuration
;;; zh-cn input method pyim/rime (require 'pyim) (require 'posframe) (add-to-list 'load-path "/home/rws/hack/lisp/liberime/build/") ;; set to wherever liberime.so is built, see the above section (require 'liberime) (setq default-input-method "pyim") (setq pyim-page-tooltip 'posframe) (setq pyim-page-length 9) (liberime-start "/usr/share/rime-data/" (file-truename "~/.emacs.d/pyim/rime/")) (liberime-select-schema "double_pinyin_mspy") (setq pyim-default-scheme 'rime-microsoft-shuangpin)
Note: please see pyim’s README for more options
Simplified Chinese
However, I can only type traditional Chinese characters with the above setup.
Following rime’s wiki page, edit the corresponding double pinyin schema file: /usr/share/rime-data/double_pinyin_mspy.schema.yaml
:
-
rename “simplification” to “zh_simp” and add “reset: 1” under it.
from:switches: - name: ascii_mode reset: 0 states: [ 中文, 西文 ] - name: full_shape states: [ 半角, 全角 ] - name: simplification states: [ 漢字, 汉字 ] - name: ascii_punct states: [ 。,, ., ]
to:
switches: - name: ascii_mode reset: 0 states: [ 中文, 西文 ] - name: full_shape states: [ 半角, 全角 ] - name: zh_simp reset: 1 states: [ 漢字, 汉字 ] - name: ascii_punct states: [ 。,, ., ]
-
add simplifier filter at the end of the schema file:
simplifier: option_name: zh_simp
- save and restart Emacs, now pyim should be using simplified Chinese.