GithubHelp home page GithubHelp logo

ace-pinyin's Introduction

ace-pinyin

http://melpa.org/packages/ace-pinyin-badge.svg http://stable.melpa.org/packages/ace-pinyin-badge.svg

Jump to Chinese characters using ace-jump-char-mode or avy-goto-char : input the first letter of the pinyin of the Chinese character, then use ace-jump-char-mode or avy-goto-char to jump to it.

UPDATE: The up-to-date version now supports avy, which I personally think is better than ace-jump-mode. However, by default this package is still using ace-jump-mode.

UPDATE: Now avy-goto-char-2 is also supported if you set ace-pinyin-use-avy to be t.

Setup

(add-to-list 'load-path "/path/to/ace-pinyin.el")
(require 'ace-pinyin)

Or install via melpa.

Usage

You can make the ace-pinyin use avy by:

(setq ace-pinyin-use-avy t)

Note ace-pinyin-use-avy variable should be set BEFORE you call ace-pinyin-global-mode or turn-on-ace-pinyin-mode.

Example config to use ace-pinyin globally:

;; (setq ace-pinyin-use-avy t) ;; uncomment if you want to use `avy'
(ace-pinyin-global-mode +1)

If you want to turn on/off ace-pinyin-mode locally, don’t directly call ace-pinyin-mode. Use turn-on-ace-pinyin-mode or turn-off-ace-pinyin-mode instead.

When the minor mode is enabled, then ace-jump-char-mode (or avy-goto-char, depends on your config) will be able to jump to both Chinese and English characters. That is, you don’t need remember an extra command or create extra key bindings in order to jump to Chinese character. Just enable the minor mode and use ace-jump-char-mode (or avy-goto-char) to jump to Chinese characters.

Besides, all other packages using ace-jump-char-mode (or avy-goto-char) will also be able to jump to Chinese characters. For example, if you’ve installed ace-jump-zap, it will also be able to zap to a Chinese character by the first letter of pinyin. Note ace-jump-zap is implemented by using ace-jump-mode, so you can’t use avy in this case. You can check out my fork of ace-jump-zap using avy: avy-zap.

Other available command

ace-pinyin-dwim

If called with no prefix, it can jump to both Chinese characters and English letters. If called with prefix, it can only jump to Chinese characters.

ace-pinyin-jump-word

Using this command, you can jump to the start of a sequence of Chinese characters(i.e. Chinese word) by typing the sequence of the first letters of these character’s pinyins. If called without prefix, this command will read user’s input with a default timeout 1 second(You can customize the timeout value). If called with prefix, then it will read input from the minibuffer and starts search after you press “enter”.

Demo

WARNING: The demo is a little out of date. You should use ace-pinyin-global-mode (globally) or turn-on-ace-pinyin-mode (locally) instead of ace-pinyin-mode to enable the minor mode!

Enable ace-pinyin-mode and use ace-jump-char-mode to jump to Chinese characters: ./screencasts/ace-pinyin-jump-char.gif

If you have installed ace-jump-zap, then enabling ace-pinyin-mode will also make ace-jump-zap-to-char capable of handling Chinese characters. ./screencasts/ace-jump-zap.gif

Acknowledgment

The letter to Chinese character table(ace-pinyin--char-table in code) is from https://github.com/redguardtoo/find-by-pinyin-dired.

ace-pinyin's People

Contributors

cute-jumper avatar syohex avatar xuchunyang avatar

Watchers

 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.