Are you Vim user and have you ever investigated long server logs with multiple identifiers needed to be tracked? Check out my plugin Vim syntax match that can help you with it.
This happens to me quite often with WildFly and transaction identifiers. Thus I was searching how to make my life easier in this respect. I found that colorizing referred parts of the log helps me to follow and understand what has happened.
match command (and its alternatives
3match). You say what color to use and what text to mark with the color.
You do it in way
:match <color> /<pattern>/. The example would be for
:match DiffAdd /2018-[^ ]*/.
This expression colorize text starting with
2018- up to the space in the text
with color named
DiffAdd. You can search for available colors when you write
:highlight (shortcut as
:hi). And you can define your own color with
:hi <new-color-name> <terminal-type>=<color-code> (see details at
As an example
:hi yellow guibg=#dfff87 ctermbg=192 where we define a color name
to colorize background with color of code
Check the color codes for example here https://jonasjacek.github.io/colors/.
But this is restricted only to three text patterns to be highlighted. If you need
more you can define your own arbitrary syntax match rules with
:syntax match DiffAdd /2018-[^ ]*/.
This sounds fine but it requires more text typing than I liked.
The second pain point that I feel was loosing all the knowledge connected with the hightligting the important parts of the texts (in my case they were identifiers in the server log) when I closed the file. I longed for the tool which preserves the colors for me.
Vim synax match plugin
As I haven’t found any I decided to created a Vim plugin adressing all my desires.
And you can find it at https://github.com/ochaloup/vim-syntax-match
What it offers? As it was said:
text highlighting shortcuts for several colors, like
:Y <pattern>for yellow background or
:GF <pattern>for green foreground
saving the existing highlighting pattern to be loaded next time the file is opened (automatically works with
If you install it and wish to get highlighted the pattern introduced in the initial section of this blogpost,
you can write just(!)
:Y 2018-[^ ]*.
If you want to know what all the shortcuts the plugin offers don’t hesitate to check the helper commands at the README file and you can read all the details how the plugin works at https://github.com/ochaloup/vim-syntax-match#how-works-internally.
How to install
For whole installation guidelines see
README file at https://github.com/ochaloup/vim-syntax-match#how-to-install.
Do you know that you can open a secondary file as a vertical Vim window having those to being scrolled together? Try
:set scrollbind. Alternatively use plugin user command
Do you know Vim can export the opened file as HTML page where highligting is applied? Try to run
:Tohtml. Alternatively use the plugin user command
:TOHtmlWithLineswhich adds clicable line numbers on top of the output provided by