wolray / symbol-overlay

Highlight symbols with keymap-enabled overlays
346 stars 42 forks source link

[Feature Request] jump and help #32

Closed seagle0128 closed 5 years ago

seagle0128 commented 5 years ago

Hi, I love this amazing package and I'm enjoying!

I have two requirements. Can you think about them?

  1. Jump to the first and the last. I have the implementation for it.
    
    (defun symbol-overlay-switch-first ()
      (interactive)
      (let* ((symbol (symbol-overlay-get-symbol))
             (keyword (symbol-overlay-assoc symbol))
             (a-symbol (car keyword))
             (before (symbol-overlay-get-list a-symbol 'car))
             (count (length before)))
        (symbol-overlay-jump-call 'symbol-overlay-basic-jump (- count))))

(defun symbol-overlay-switch-last () (interactive) (let* ((symbol (symbol-overlay-get-symbol)) (keyword (symbol-overlay-assoc symbol)) (a-symbol (car keyword)) (after (symbol-overlay-get-list a-symbol 'cdr)) (count (length after))) (symbol-overlay-jump-call 'symbol-overlay-basic-jump (- count 1))))


I bind to `<` and `>` in ` symbol-overlay-map`.

I can make a PR if you agree.

2. Show help for keybindings. Suggest to bind to `h`.

BTW: `doom-modeline` supports `symbol-overlay`. Refer to https://emacs-china.org/t/package-symbol-overlay-symbol/7706/18?u=seagle0128. 
purcell commented 5 years ago

For the jumping, see #28.

I've added a help binding in 39a2ad8.

Thanks!