I'm trying to define my own user defined language in notepad++. Reason: I want to introduce coloring schemes for different logfile entries. Does anbody know if there is a way to highlight the complete line containing a specific keyword?
You could use comment line if the special keyword is at the beginning
If what you want is to know the lines with some errors, you better use the Mark tab of the search window with the check of Bookmark line.
[Edited 28 June 2016]
If you want a more powerful solution that fits your need exactly, you can try with the plugin Python Scripts.
Once the plugin installed, you can write a python script.
Create in your script a function highlight_preprocessor that does the following:
For each keyword you have, remove any previous highlight by calling Editor.markerDeleteAll(<ID_keyword>) where <ID_keyword> is a digit associated to the keyword (e.g. 10 for error, 11 for warning, etc.)
For each <ID_keyword>, set the colors of the highlight (e.g. dark gray) by calling the function editor.markerSetBack(<ID_keyword>, (<R>, <G>, <B>) ) (where the last 3 numbers are the RGB values of the color - 20/20/20 for dark grey)
Parse the text of your document and for each line matching a keyword, call the function editor.markerAdd(<line_number>, <ID_keyword>)
Call the function each time the file is saved by putting this line at the end of your script notepad.callback(highlight_preprocessor, [NOTIFICATION.FILEBEFORESAVE])
Takes some time and effort to make it work but at least it is possible.
0
karthik8fd
On
use ((EOL)) in close: so that it highlights till the end of the line with a specific keyword.
You could use comment line if the special keyword is at the beginning
If what you want is to know the lines with some errors, you better use the Mark tab of the search window with the check of
Bookmark line
.[Edited 28 June 2016]
If you want a more powerful solution that fits your need exactly, you can try with the plugin Python Scripts.
Once the plugin installed, you can write a python script.
highlight_preprocessor
that does the following:Editor.markerDeleteAll(<ID_keyword>)
where<ID_keyword>
is a digit associated to the keyword (e.g. 10 for error, 11 for warning, etc.)<ID_keyword>
, set the colors of the highlight (e.g. dark gray) by calling the functioneditor.markerSetBack(<ID_keyword>, (<R>, <G>, <B>) )
(where the last 3 numbers are the RGB values of the color - 20/20/20 for dark grey)editor.markerAdd(<line_number>, <ID_keyword>)
notepad.callback(highlight_preprocessor, [NOTIFICATION.FILEBEFORESAVE])
Takes some time and effort to make it work but at least it is possible.