Notepad++: Rule based line highlighting

27

11

Is there a way to automatically highlight lines based on predefined rules in Notepad++?

I'm not talking about syntax highlighting, but rather about log files readability.

I'm looking either for a feature I've missed, or a plugin.

Jonathan

Posted 2010-12-11T00:20:57.933

Reputation: 3 371

Would line hiding suffice? I'm thinking hiding lines that you don't want to see so that you can more easily see the important lines. – MBraedley – 2010-12-11T03:02:22.073

@MBraedley - That sounds useful, how do you do that? But for my usecase it's not a good solution, I need to see many lines of log and coloring them based on their contents would help me greatly – Jonathan – 2010-12-11T16:18:30.907

2Line hiding is under TextFX->TextFX Viz. – MBraedley – 2010-12-11T20:22:43.797

Answers

8

  1. Select Language > Define your language... (or View Language > User-Defined Dialog..., or Language > User-Defined, depending on version and localisation file)
  2. Use the User-Defined dialogue to specify what to highlight. To highlight certain words, use the Keyword Lists tab and enter each word in a Group, selecting Colour/Font style as you like. You can also use Comment Line on the Comment & Number tab to highlight from a word to the end of the line (check Treat keyword as symbol for partial word match).
  3. Select Language > User-Defined

If you want to use this highlighting scheme regularly, you can save it by clicking Save As.... This scheme should now be listed under the Language menu of the main Notepad++ window.

Gnubie

Posted 2010-12-11T00:20:57.933

Reputation: 2 371

@Jonathan > by following directions gave by Žiga Stegu answer and adding it in Operators and delimiters tab, I've been able to highlight whole lines. – AFract – 2017-02-22T21:38:13.210

3almost but no cigar... I really need to highlight certain lines in a log file. not certain words or from a word onward... – Jonathan – 2012-02-21T13:54:22.870

6

As stated before me:

Select Language > Define your language... (or View Language > User-Defined Dialog..., or Language > User-Defined, depending on version and localisation file)

In my case. I needed to color code lines starting with "V"{tab} I set Delimiter 1 style:

  • Open: V
  • Escape:
  • Close:((EOL))

This would highlight also mid text V and on, so I copied a {tab} into

Open: V{tab} //{tab} is not visible but present

I found out that {tab} is in exported .xml encoded as 	 which stands for http://www.unicodemap.org/details/0x0009/index.html exactly what I needed. So by modifing the xml with unicode caracter codes

Joze Novak

Posted 2010-12-11T00:20:57.933

Reputation: 61

This has to be done in the "Operators and delimiters" tab to work – AFract – 2017-02-22T21:34:28.067

it does not colorize/style the entire line (or to the end of the line) as was asked – ZEE – 2019-11-01T19:33:22.883

5

I have the same need. "Highlighting lines that contain specific keywords". I currently use Baretail or better: Glogg for this, but it would be nice to see this in Notepad++.

I generally use Notepad++ to browse through log files. Certain events start with specific keywords; line highlighting in Notepad++ would allow me to quickly find the events in the log.

cvdabbeele

Posted 2010-12-11T00:20:57.933

Reputation: 51

3

There's a plugin for N++ now called AnalysePlugin that might fit the bill. It allows for normal, regex, and escaped searches. It dumps results to another pane but you can color foreground and background properties of the results as well as save and load filter sets.

ryanr

Posted 2010-12-11T00:20:57.933

Reputation: 31