Giter Site home page Giter Site logo

highlight-thing.el's Introduction

highlight-thing.el

Global minor mode to highlight the thing under point.

MELPA

Similar to highlight-symbol-mode, but does not rely on font-lock functionality and does not provide functionality to navigate to different occurrences of the current symbol under point.

No external dependencies, uses thingatpt and hi-lock functionality that is included with GNU Emacs.

Demo

Installation

Basic setup:

  (require 'highlight-thing)
  (global-highlight-thing-mode)

Alternatively you can use the buffer-local version:

  (add-hook 'prog-mode-hook 'highlight-thing-mode)

The default is to highlight the symbol under point, but you can customize hightlight-thing-what-thing to highlight different components. Set the following to only highlight the word under point:

  (setq highlight-thing-what-thing 'word)

As an extension to the thing-at-point capabilities you can select region in which case an active region is used as the thing to highlight (cf. #7).

@antoineB provided the functionality to use a custom regex function for a thing-at-point - thanks! For his use case, cf. #18. To use it store the custom regex function as the property highlight-thing-regex-fn on your thing-at-point:

  (put 'word 'highlight-thing-regex-fn 'your-regex-fn)

Customize the face hi-yellow to change the colors that are used for highlighting.

You can customize the delay before this mode attempts to highlight the thing under point. For example, push it out to 1.5 seconds from the default 0.5:

  (setq highlight-thing-delay-seconds 1.5)

You can limit the highlighting of things to the current defun via the following setting:

  (setq highlight-thing-limit-to-defun t)

You can configure the matching of occurrences to be case-sensitive via the following setting:

  (setq highlight-thing-case-sensitive-p t)

If you want all the matches highlighted but not the one occurrence at the point itself, you can do so by:

  ;; Don't highlight the thing at point itself. Default is nil.
  (setq highlight-thing-exclude-thing-under-point t)

If you want to highlight the current region when active or thing at point when inactive:

  (setq highlight-thing-prefer-active-region t)

If you want to prevent highlighting certain strings:

  (setq highlight-thing-ignore-list '("False" "True"))

If you want to highlight in all visible buffers:

  (setq highlight-thing-all-visible-buffers-p t)

If you want to restrict the highlighting to lines surrounding points, e.g. to reduce the load of highlighting in large buffers as in #16, consider customizing the following variables:

  (setq highlight-thing-limit-to-region-in-large-buffers-p nil
        highlight-thing-narrow-region-lines 15
        highlight-thing-large-buffer-limit 5000)

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.