Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight specific keywords in the terminal as they appear

In iTerm2 you can create triggers that highlight a line if your regex matches. This is great for some cases but I was wondering if it was possible to highlight only a word on a specific line.

The purpose of this is to help read my server logs where specific keywords can be easily pointed out. Highlighting the entire line is a bit distracting

like image 286
mikeymurph77 Avatar asked Jan 04 '17 16:01

mikeymurph77


People also ask

How do you highlight keywords?

Enable highlighting with ⇧ ⌘ H , from the gear menu (⚙ Highlight Keywords), or open the keyword drawer using the highlighter icon in the lower left (near the gear menu).

How do you highlight text in Linux?

shift + ← or shift + → to highlight text. shift + ctrl + ← or shift + ctrl + → to highlight an entire word.

How do you highlight text in iTerm2?

Enable HighlightingIn your iTerm2 Profile settings (iTerm2 Preferences => Profiles) switch to Advanced and look for the Triggers section. Click Edit to add your own triggers. To solve my issue; we add a regular expression for the words we want to highlight.


1 Answers

A Profile-based trigger can highlight as much or little of a line as you choice (via the regex).

To highlight just a "word" in a line, you can create a simple Highlight Text trigger, i.e.:

enter image description here

Results in:

enter image description here

Ref: https://iterm2.com/documentation-triggers.html

Below is where you will find Triggers enter image description here

like image 108
SushiHangover Avatar answered Sep 27 '22 19:09

SushiHangover