cute-jumper / ace-pinyin

Jump to Chinese character by pinyin with `avy' or `ace-jump-mode`
87 stars 19 forks source link

Add support for avy-goto-char-timer #15

Closed wowhxj closed 2 years ago

wowhxj commented 2 years ago

Hey there, thanks very much for this package.

ace-pinyin has already supported following avy commands:

;;   When using `avy', all `avy' commands (as of 05/06/2016) related to
;;   char/word jumping are supported:
;;   - `avy-goto-char'
;;   - `avy-goto-char-2'
;;   - `avy-goto-char-in-line'
;;   - `avy-goto-word-0'
;;   - `avy-goto-word-1'
;;   - `avy-goto-subword-0'
;;   - `avy-goto-subword-1'
;;   - `avy-goto-word-or-subword-1'

Unfortunately, it doesn't support avy-goto-char-timer command which is more useful for me.

Would you please help to add support for this command?

wowhxj commented 2 years ago

Got from: emacs-china.org. Tested and it worked very well.

(defun my/avy-goto-char-timer (&optional arg)
    (interactive "P")
    (let ((avy-all-windows (if arg
                               (not avy-all-windows)
                             avy-all-windows)))
      (avy-with avy-goto-char-timer
        (setq avy--old-cands (avy--read-candidates
                              'pinyinlib-build-regexp-string))
        (avy-process avy--old-cands))))