Add rokulog detection of "publishing" channels
dblume

dblume commited on 2024-12-02 08:50:39
Showing 2 changed files, with 5 additions and 5 deletions.


Since we're detecting rokulog by format of the first line,
detect publishing channel IDs like "358_72dbe"
... ...
@@ -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\+\|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,
... ...
@@ -1,10 +1,10 @@
1 1
 " For vim put this in ~/.vim/scripts.vim.
2
-" For neovim: See ~/.config/nvim/init.vim
3
-" See https://www.reddit.com/r/neovim/comments/wcq6sp/override_file_type_detection_for_existing/
2
+" neovim doesn't even call scripts.vim if filetype was done.
3
+" See ~/.config/nvim/init.vim and
4
+" https://www.reddit.com/r/neovim/comments/wcq6sp/override_file_type_detection_for_existing/
4 5
 if did_filetype()  " filetype already set..
5 6
   finish           " ..don't do these checks
6 7
 endif
7
-" Close, didn't bother making it match publishing channels like 12_a42f:
8
-if getline(1) =~? '^\d\{2\}-\d\{2\} \d\{2\}:\d\{2\}:\d\{2\}.\d\{3\}\s\+\(n\|dev\|\d\+\|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