Skip to content

Instantly share code, notes, and snippets.

@merrickluo
Last active September 18, 2023 09:22
Show Gist options
  • Save merrickluo/553f39c131d0eb717cd59f72c9d4b60d to your computer and use it in GitHub Desktop.
Save merrickluo/553f39c131d0eb717cd59f72c9d4b60d to your computer and use it in GitHub Desktop.
Use pyim + liberime in doom-emacs
(use-package! liberime-config)
(use-package! pyim
;; :quelpa (pyim :fetcher github :repo "merrickluo/pyim")
:init
(setq pyim-title "R")
:config
;; (use-package pyim-basedict
;; :config
;; (pyim-basedict-enable))
(global-set-key (kbd "M-j") 'pyim-convert-string-at-point)
(setq pyim-dcache-auto-update nil)
(setq default-input-method "pyim")
;; 我使用全拼
(setq pyim-default-scheme 'rime)
(setq pyim-page-tooltip 'child-frame)
;; 设置 pyim 探针设置,这是 pyim 高级功能设置,可以实现 *无痛* 中英文切换 :-)
;; 我自己使用的中英文动态切换规则是:
;; 1. 光标只有在注释里面时,才可以输入中文。
;; 2. 光标前是汉字字符时,才能输入中文。
;; 3. 使用 M-j 快捷键,强制将光标前的拼音字符串转换为中文。
(setq-default pyim-english-input-switch-functions
'(pyim-probe-dynamic-english
pyim-probe-isearch-mode
pyim-probe-program-mode
pyim-probe-evil-normal-mode
pyim-probe-org-structure-template))
(setq-default pyim-punctuation-half-width-functions
'(pyim-probe-punctuation-line-beginning
pyim-probe-punctuation-after-punctuation)))
(package! liberime-config
:recipe (:host github :repo "merrickluo/liberime"
:files ("CMakeLists.txt" "Makefile" "src" "liberime-config.el")))
  • Steps
  1. enable chinese package in ~/.doom.d/init.el
  2. add gist content to ~/.doom.d/package.el and ~/.doom.d/config.el
  3. reload doom to install packages PS. you need to install librime following here
  4. create default.custom.yaml in ~/.emacs.d/rime and paste content there (the schema_list part is only for simplified chinese user)
patch:
menu:
page_size: 100
schema_list:
- schema: luna_pinyin_simp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment