jonas / tig

Text-mode interface for git
https://jonas.github.io/tig/
GNU General Public License v2.0
12.28k stars 604 forks source link

Highlight matching regex pattern in pager, via option color-pager-regex #1249

Closed psprint closed 1 year ago

psprint commented 1 year ago

A third attempt after #1223 to commit flexible pager view output highlighter.

Any line matching the regex given by option color_pager_regex will be drawn in a new color ↔ color-match. The option is empty by default, as requested. The color is magenta by default.

Example: 2022-12-27-150236_1888x926_scrot

Typically useful to make compiler warnings easy visible.

psprint commented 1 year ago

Hi, Could be the PR be merged? It's an useful feature, I'm just used it to highlight a preamble of introducionary lines in a Tig run as the item chooser (like fzf), which is nice as the UI is the same as Tig.

koutcher commented 1 year ago

Once again you reinvent the wheel, Tig already has a coloring engine that can be extended to support regular expressions... Look for the updated syntax in the commit message or in tigrc.5.adoc.

psprint commented 1 year ago

The new support is great, I was able to colorize output of my new tigsuites feature plugin:

It allows to create project and subproject file lists that can be opened from tig: 2023-01-07-163841_1889x1045_scrot

However, it seems that the color always spans whole line. Would it be hard to colorize different parts of lines in different color?