Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Something I've found useful is to highlight (in bold) the definitions of variables & types, but not their uses; and to otherwise have very little highlighting: http://david.rothlis.net/code_presentation/distracting_synta...


This just made me think that highlighting would be way more interesting if you could change the scheme on the fly. An editor could have 5-10 highlighting schemes—not different colors, but different kinds of information shown (because let's face it, highlighting is valuable information).

Examples I just thought up:

* Variable-scoping-level highlighting—variables in the same scope highlighted the same color.

* "String only"—highlight only strings and literals. Check for language bugs.

* grep-only highlighting—define a set of things to grep for quickly and highlight them.

* block-focused—highlight code blocks so you get an idea of the overall structure of your program.

* No-highlighting: if you really want a moment of clarity on your code. There is absolutely no reason to give up the information highlighting provides 100% of the time, but I could see it being useful sometimes when you need to focus.

And countless more. If I could switch with a quick keyboard shortcut to a highlighting scheme appropriate for any given programming task, it would be phenomenal. I could see it being useful for all kinds of things, and helping to show more information from the compiler than syntax highlighting does already, in a better way. It would be instant visual information, and there's no reason to limit it to syntax like we do currently.

Hmm. Sublime Text Plugin perhaps?


> Variable-scoping-level highlighting—variables in the same scope highlighted the same color.

I played with this idea in the syntax highlighting of the code samples in this article: http://david.rothlis.net/c/compilation_model/#chapter005

but would you want all variables at the same scope in the same colour? Different colours for each variable, with the darkness/lightness indicating the scope?

> grep-only highlighting—define a set of things to grep for quickly and highlight them.

Emacs has this with the "highlight-regexp" command. To be honest I don't use it that much. What I do like is highlighting all matches whenever you're doing a "find in file" (though unlike highlight-regexp, the highlighting disappears as soon as you exit the search). I probably use this more because I use search all the time (who doesn't), whereas I tend to forget that "highlight-regexp" even exists.

> block-focused—highlight code blocks so you get an idea of the overall structure of your program.

A few examples of how this might look: http://web.archive.org/web/20080723220126/http://lemonodor.c...

> No-highlighting

In Emacs the "font-lock-mode" command will toggle all highlighting; and you can specify the "level" of highlighting you want by setting the "font-lock-maximum-decoration" variable (you could set up a specific key to toggle this variable). I think these levels were originally intended for performance reasons, so they're cumulative (enabling level 3 also brings in all the highlighting from levels 1 & 2) rather than individually-toggleable features.

I only bring up Emacs because that's what I'm familiar with, and because I'd like more people to experiment with these types of things in Emacs. But perhaps Sublime Text would be a better platform for such experiments, for some people; I don't know.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: