CodeblockCustomizer icon indicating copy to clipboard operation
CodeblockCustomizer copied to clipboard

Suggestion to improve existing text-only highlighting features.

Open Truncated opened this issue 8 months ago • 10 comments

I've been documenting the results of regular expressions in code blocks, so I've been pushing the highlighting by word feature. Overall, this works a treat, so thank you!

Three things I couldn't find but really wished I could do repeatedly. Maybe I missed them?

  1. Highlight an entire line words only without the abc:xyz method.
  2. Easily start the word highlight without tabs or spaces at the start. hl:1|:xyz will always highlight from the start of a line (^ in RegEx) at the word level.
  3. Specify the end of the line without specific letters/word combos. No way to grab multiple lines by using :s or :en, as it only goes as far as the first match.

Without these three options, I found I needed to specify many lines of filtering to get all of the nuances at the word level.

To improve this experience, I would propose hlw: as an additional command that works exactly as hl does today but with these three key differences.

  1. All highlighting is interpreted as word only; it never highlights lines as a result. hlw:1 would effectively be /^.*$/ for the 1st line in regex, for example.
  2. If no value is provided to the left of a colon in abc:xyz eval,, it is interpreted as the first non-breaking space from the start of the string.
  3. If no value is provided to the right of a colon in abc:xyz eval, it is interpreted as the end of the string (/$/).

Theoretically, this could also be applied to any custom alternative highlight colors by finding an extra w at the end of any custom defined names. i.e. If I added error and warn as alternative highlight colors, these rules above could be applied to those alternate highlight colors if use them as errorw:2,4-6 and warnw:2,4-6, respectively.

Truncated avatar Jun 20 '24 02:06 Truncated