Code Monkey home page Code Monkey logo

Comments (6)

purcell avatar purcell commented on July 18, 2024

Yep, that would be useful.

from symbol-overlay.

wolray avatar wolray commented on July 18, 2024

Before having this new feature, you might found it helpful using symbol-overlay-switch-backward/forward:

  1. highlight the target symbol first
  2. go to the beginning/end of the buffer
  3. trigger the command to jump to the target symbol

from symbol-overlay.

manuel-uberti avatar manuel-uberti commented on July 18, 2024

@wolray I tried the steps you're suggesting, but it's not as quick as having the possibility to jump straight to the first/last occurrence.

from symbol-overlay.

zilongshanren avatar zilongshanren commented on July 18, 2024

@Wilfred @manuel-uberti @purcell

After dig into the source code for 10 mins, I have made one, hope it helps:

BTW. Emacs really rocks. 😄

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

(define-key symbol-overlay-map (kbd "<") 'symbol-overlay-switch-first)
(define-key symbol-overlay-map (kbd ">") 'symbol-overlay-switch-last)


from symbol-overlay.

purcell avatar purcell commented on July 18, 2024

A few people have asked for this now, so I feel this is worth adding. Would someone like to file a pull request, perhaps based on the snippet above?

from symbol-overlay.

wolray avatar wolray commented on July 18, 2024

Commands are added as symbol-overlay-jump-first and symbol-overlay-jump-last.

See the home page.

from symbol-overlay.

Related Issues (20)

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.