Visually distinguish different lines (for long wrapped lines) in iTerm2 / Terminal

command lineitermterminal

I'm using an application that outputs very long lines. It's fine – it means things aren't cut off at 80 characters – but the default Terminal and iTerm2 config makes it hard to distinguish between:

  • the second line of a wrapped long line
  • the start of the next line

Eg:

Lorem ipsum dolor sit amet, consectetur 
adipiscing elit. 
Proin sed velit nibh. Proin ornare nisi 
at erat congue, vel dignissim tortor malesuada. 

Is there any way I can configure the app to show things so that there's some space after each carriage return, eg:

Lorem ipsum dolor sit amet, consectetur 
adipiscing elit. 

Proin sed velit nibh. Proin ornare nisi 
at erat congue, vel dignissim tortor malesuada. 

Thanks very much!

Best Answer

Here's a starting point.

In iTerm 2 go to Preferences > Profiles > (Your profile) > Advanced, then click Edit under Triggers.

Add a new Trigger using the + button at the bottom left, then set:

  • Regular Expression: .$
  • Action: Highlight Text…
  • Parameters: Red on White (or a colour combination you find appropriately funkadelic)

Close the Triggers pane.

You should now see a white "line" at the far right of the iTerm window. This is really iTerm changing the last character on the line to red text on a white background. This should help you spot lines that are wrapped versus new lines.

Example screen grab below (I use fish shell, btw)…

Screen grab of iTerm2 fish shell showing use of Triggers to highlight text