Support vim detection of local serial logs
dblume

dblume commited on 2024-12-02 11:29:08
Showing 2 changed files, with 2 additions and 2 deletions.


Support logs with the '!' and '*' columns, and that are missing
the channel ID. So support both:

11-19 15:36:59.959     12 [...] ...

and

11-19 15:36:59.959 !*[...] ...
11-19 15:36:59.959   [...] ...
... ...
@@ -455,7 +455,7 @@ lua << EOF
455 455
       priority = -math.huge,
456 456
       function(path, bufnr)
457 457
         local content = vim.filetype.getlines(bufnr, 1)
458
-        if vim.filetype.matchregex(content, [[^\d\{2\}-\d\{2\} \d\{2\}:\d\{2\}:\d\{2\}.\d\{3\}\s\+\(n\|dev\|\d\+\(_[0-9a-f]\+\)\?\|tvinput\.\S\+\) \[]]) then
458
+        if vim.filetype.matchregex(content, [[^\d\{2\}-\d\{2\} \d\{2\}:\d\{2\}:\d\{2\}.\d\{3\}\s\+\(!\|n\|dev\|\d\+\(_[0-9a-f]\+\)\?\|tvinput\.\S\+\)\?[ *]\[]]) then
459 459
           return 'rokulog'
460 460
         end
461 461
       end,
... ...
@@ -5,6 +5,6 @@
5 5
 if did_filetype()  " filetype already set..
6 6
   finish           " ..don't do these checks
7 7
 endif
8
-if getline(1) =~? '^\d\{2\}-\d\{2\} \d\{2\}:\d\{2\}:\d\{2\}.\d\{3\}\s\+\(n\|dev\|\d\+\(_[0-9a-f]\+\)\?\|tvinput\.\S\+\) \['
8
+if getline(1) =~? '^\d\{2\}-\d\{2\} \d\{2\}:\d\{2\}:\d\{2\}.\d\{3\}\s\+\(!\|n\|dev\|\d\+\(_[0-9a-f]\+\)\?\|tvinput\.\S\+\)\?[ *]\['
9 9
   setfiletype rokulog
10 10
 endif
11 11