Code Monkey home page Code Monkey logo

Comments (11)

wolray avatar wolray commented on July 18, 2024 3

Good news! We have symbol-overlay-mode now.

Check the new feature after Melpa finish this build. Wish you enjoy it.

@borgnix @dakra

from symbol-overlay.

dakra avatar dakra commented on July 18, 2024 1

@borgnix jFYI, until this get's implemented here I have the following in my config:

;; Make highlight symbol use overlay-put instead of font-lock
;; https://github.com/nschum/highlight-symbol.el/issues/26#issuecomment-233168193
(defun highlight-symbol-add-symbol-with-face (symbol face)
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward symbol nil t)
      (let ((ov (make-overlay (match-beginning 0)
                              (match-end 0))))
        (overlay-put ov 'highlight-symbol t)
        (overlay-put ov 'face face)))))

(defun highlight-symbol-remove-symbol (_symbol)
  (dolist (ov (overlays-in (point-min) (point-max)))
    (when (overlay-get ov 'highlight-symbol)
      (delete-overlay ov))))

from symbol-overlay.

dakra avatar dakra commented on July 18, 2024 1

Very nice :)

I see the mode does not have a keymap and if I call
symbol-overlay-jump-next it says 'Symbol is not highlighted'.

I would like to bind M-n and M-p in a symbol-overlay-mode-map so
I can easily jump between the highlighted symbols.

Also is there a setting for the toggle-scope? I would like to
only show current scope by default.

Thanks :)

from symbol-overlay.

wolray avatar wolray commented on July 18, 2024

I use "o/u" as the common next-and-prev-like bindings when searching or moving over texts because they are at the most natural positions on the keyboard. It's comfortable for my fingers: "u/o" to move around while "i" for confirming/toggling and "k" for killing/deleting.

However, It's just a matter of personal taste. You can customize the keymap as you like.

highlight-symbol-mode is indeed a nice feature though I had hardly used it. Maybe it will be added to symbol-overlay in the future versions.

Thanks.

from symbol-overlay.

ruibinx avatar ruibinx commented on July 18, 2024

please add this feature :)

from symbol-overlay.

ruibinx avatar ruibinx commented on July 18, 2024

@dakra Thank you!

from symbol-overlay.

wolray avatar wolray commented on July 18, 2024

You can easily define a symbol-overlay-mode-map in your own init.el. And it will automatically linked to the minor-mode. Or why not just simply global-set the key?

The user-error of 'Symbol is not highlighted' is deleted, now you can start a jump from any position even inside a not-highlighted symbol. Same to all the other symbol-overlay commands.

For some reasons, scope is not supported in symbol-overlay-mode. If you wanna toggle the scope, use symbol-overlay-put to highlight it first.

from symbol-overlay.

wolray avatar wolray commented on July 18, 2024

Alright, you can set symbol-overlay-temp-in-scope to be non-nil to make symbol-overlay-mode highlighting in scope by default, and toggle its value anywhere outside the package.

from symbol-overlay.

dakra avatar dakra commented on July 18, 2024

Awesome.

I tried to set the minor-mode-map in use-package but that
didn't really work.
Anyway, using a global key is probably a good idea anyway.

One more thing, I saw you added symbol-overlay-switch-forward/backward
which I like very much and would rather use those
than symbol-overlay-jump-next.. but those functions
are not yet supported in the minor-mode ("No more forward symbols").

Good job 👍

from symbol-overlay.

wolray avatar wolray commented on July 18, 2024

switch-forward/backward is for jumping from one symbol to another one. It doesn't make sense to support it in the minor mode, since the symbol at point is already highlighted.

The best philosophy about symbol-overlay is to use jump for jumping between occurrences of a specific symbol, and switch for finding and switching to a new one. As for the minor-mode, just treat it as a sort of quick preview.

:)

from symbol-overlay.

dakra avatar dakra commented on July 18, 2024

The thing is that I want one single keybinding.
So I guess I want a symbol-overlay-jump-next-dwim then,
that, if symbol-overlay-minor-mode is active AND a symbol is
under (point) I want to call jump-next else do switch-forward.

Does this make sense?

Anyway, this is obviously only a very minor thing.
Closing the issue already since it works pretty much like I want now :)

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.