GithubHelp home page GithubHelp logo

ba11astone / emacs-rime Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doglooksgood/emacs-rime

0.0 0.0 0.0 195 KB

RIME ㄓ in Emacs

License: GNU General Public License v3.0

Emacs Lisp 68.17% Makefile 1.20% C 30.63%

emacs-rime's Introduction

Emacs Rime

中文文档

https://i.imgur.com/S15IbwJ.gif

Emacs in Rime, support multiple schemas.

Installation

Requirements

Emacs 26.1+ with dynamic modules support, gcc and make.

emacs-rime will build dynamic module automatically.

Install librime

Linux

You can install librime with package manager.

It is named librime in Arch/Manjaro, and librime-dev in Debian/Ubuntu, etc.

MacOS

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

Minimal configuration

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")

Keybindings in Rime.

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"))

Candidate menu style

Set via rime-show-candidate.

Valuedescription
nildon’t show candidate at all.
minibufferDisplay in minibuffer.
messageDisplay with message function, useful when you use minibuffer as mode-line.
popupUse popup.
posframeUse posfarme, will fallback to popup in TUI

Open Rime menu

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))
  ...
  )

The lighter

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.

Temporarily ascii mode

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 and conf-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,

Force enable

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.

The soft cursor

Default to | , you can customize it with

(setq rime-cursor "˰")

Shortcut to open Rime configuration file

Use rime-open-configuration.

FAQ

How to get Emacs with dynamic module support?

Linux

Emacs included in major linux distributions has dynamic module support enabled by default.

MacOS

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

Compile Emacs 26 manually

Use --with-modules option.

Can’t find rime_api.h when compile

You MUST specify rime-librime-root in this case.

Check Installation for how to set.

Can’t find emacs-module.h when compile

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")

Thanks for all the contributors

emacs-rime's People

Contributors

cnsunyour avatar con5tella avatar doglooksgood avatar shuxiao9058 avatar wsw0108 avatar z572 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.