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?

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.