4

While it's possible to highlight a block using the character under the cursor, is there a way to highlight the scope of the current cursor?

I'm interested in something like QtCreator's block-highlight feature: enter image description here

Are there existing packages that do this or should I make my own?

ideasman42
  • 8,375
  • 1
  • 28
  • 105

2 Answers2

4

A bit long in the tooth, but still seems to work fine, highlight-sexp will do what you want. Move out of your inner if, it highlights the entire for block. Out again, the entire outer if. Out again, your function. Note that by default it highlights inside the "parens" of each scope.

example of highlight-sexp's highlighting

nega
  • 3,091
  • 15
  • 21
0

This is a minor mode I've put together that highlights multiple enclosing brackets.

See: hl-block-mode

Since it's a relatively expensive operation, it's set to run after an idle timer - to avoid it slowing down cursor-motion.

enter image description here

NickD
  • 27,023
  • 3
  • 23
  • 42
ideasman42
  • 8,375
  • 1
  • 28
  • 105