Emacs in Rime, support multiple schemas.
Emacs 26.1+ with dynamic modules support, gcc
and make
.
emacs-rime will build dynamic module automatically.
You can install librime with package manager.
It is named librime
in Arch/Manjaro, and librime-dev
in Debian/Ubuntu, etc.
You can download the release.
wget https://github.com/rime/librime/releases/download/1.5.3/rime-1.5.3-osx.zip
unzip rime-1.5.3-osx.zip -d ~/.emacs.d/librime
rm -rf rime-1.5.3-osx.zip
Use Straight
(use-package rime
:straight (rime :type git
:host github
:repo "DogLooksGood/emacs-rime"
:files ("rime.el" "Makefile" "lib.c"))
:custom
(default-input-method "rime"))
Use Quelpa
(use-package rime
:quelpa (rime :fetcher github
:repo "DogLooksGood/emacs-rime"
:files ("rime.el" "Makefile" "lib.c"))
:custom
(default-input-method "rime"))
NOTE: If you are on MacOS or don’t have librime in standard path,
you MUST specify rime-librime-root
.
Put following in the :custom
section.
(Assuming you unzip librime to ~/.emacs.d/librime)
(rime-librime-root "~/.emacs.d/librime/dist")
With following configuration, you can send a serials of keybindings to Rime. Since you may want them to help you with cursor navigation, candidate pagination and selection.
Currently the keybinding with Control(C-), Meta(M-) and Shift(S-) is supported.
;; defaults
(setq rime-translate-keybindings
'("C-f" "C-b" "C-n" "C-p" "C-g"))
Set via rime-show-candidate
.
Value | description |
---|---|
nil | don’t show candidate at all. |
minibuffer | Display in minibuffer. |
message | Display with message function, useful when you use minibuffer as mode-line. |
popup | Use popup. |
posframe | Use posfarme, will fallback to popup in TUI |
Assuming you use C-~
for the menu.
switcher:
caption: 〔方案選單〕
hotkeys:
- Control+grave
You can bind this key to rime-mode-map
with command rime-send-keybinding
.
(use-package
...
:bind
(:map rime-mode-map
("C-`" . 'rime-send-keybinding))
...
)
You can get a lighter via (rime-lighter)
, which returns you a colored ㄓ
.
Put it in modeline or anywhere you want.
You can customize with rime-title
, rime-indicator-face
and rime-indicator-dim-face
.
If you want specific a list of rules to automatically enable ascii mode, you can customize rime-disable-predicates
.
Following is a example to use ascii mode in evil-normal-state
or when cursor is after alphabet character or when cursor is in code.
(setq rime-disable-predicates
'(rime-predicate-evil-mode-p
rime-predicate-after-alphabet-char-p
rime-predicate-prog-in-code-p))
Built-in Predicate Functions
rime-predicate-after-alphabet-char-p
Only alphabet character can be entered after an alphabet character.
rime-predicate-prog-in-code-p
In the
prog-mode
andconf-mode
, Chinese characters can be entered only in comments and quotes.rime-predicate-evil-mode-p
Only alphabet character can be entered in the non-editing state of
evil-mode
.rime-predicate-punctuation-line-begin-p
Automatically switch to English punctuation when entering punctuation at the beginning of the line.
rime-predicate-auto-english-p
When entering characters, automatically switch Chinese/English with space as boundary,
If one of rime-disable-predicates
returns t, you can still force enable the input method with rime-force-enable
.
The effect will only last for one input behavior.
You probably want to give this command a keybinding.
Default to |
, you can customize it with
(setq rime-cursor "˰")
Use rime-open-configuration
.
Emacs included in major linux distributions has dynamic module support enabled by default.
emacs-plus
enables dynamic modules support by default. homebrew installation:
brew tap d12frosted/emacs-plus
brew install emacs-plus
When installing emacs-mac
, you need to add --with-modules
option. homebrew installation:
brew tap railwaycat/emacsmacport
brew install emacs-mac --with-modules
Use --with-modules
option.
You MUST specify rime-librime-root
in this case.
Check Installation for how to set.
If you build Emacs by yourself and does not install to standard location,
you MUST specify rime-emacs-module-header-root
.
Put following in the :custom
section.
(Assuming you install Emacs to ~/emacs)
(rime-emacs-module-header-root "~/emacs/include")