7

I wonder if there's already a Vim syntax highlighting in existence that I could use out-of-the-box or modify if it's close to what I want.

The log file format I want to highlight stuff in looks like this:

14:37:16.255 T#4711 The didgeridoo checked out

More formally:

  • Each line starts with a timestamp of the format HH:MM:SS.mmm, so it's fixed-width 12 characters.
  • After the timestamp is a thread identifier that starts with T# and is followed by 1 to 5 digits.
  • After the identifier comes the actual log message

I'd like to see the timestamp and identifier highlighted in separate colors from the log message.

If nothing like that already exists, what would be a reasonable way for me to add such a "filetype" myself?

3

vim-log-syntax by Alex Dzyoba seems to do a pretty good job with this.

I only needed to add the millisecond pattern to the existing time pattern and add a region match for the T#... identifier. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.