Skip to content

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

Closed
psprint wants to merge 1 commit intojonas:masterfrom
psprint:higlight-pager
Closed

Highlight matching regex pattern in pager, via option color-pager-regex#1249
psprint wants to merge 1 commit intojonas:masterfrom
psprint:higlight-pager

Conversation

@psprint
Copy link
Copy Markdown
Contributor

@psprint psprint commented Dec 27, 2022

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.

…gex`

Any line matching the regex will be drawn in a new color ↔ `color-match`.

Useful to make compiler warnings easy visible.
@psprint
Copy link
Copy Markdown
Contributor Author

psprint commented Jan 4, 2023

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
Copy link
Copy Markdown
Collaborator

koutcher commented Jan 5, 2023

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.

@koutcher koutcher closed this in d803c7b Jan 5, 2023
@psprint
Copy link
Copy Markdown
Contributor Author

psprint commented Jan 7, 2023

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?

vxsl pushed a commit to vxsl/tig that referenced this pull request Mar 18, 2026
When defining colors, strings of the form "/.../" will be interpreted as
regular expressions.

E.g. color "/([^:]+):([0-9]+):(|([0-9]+):)[ \t]+(note|warning|error): (.*)(\[-W([a-zA-Z0-8_-]+)\]|)/"	yellow	default	bold

Closes jonas#1249

Suggested-by: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants