Skip to content

Commit

Permalink
patch 9.1.0779: filetype: neomuttlog files are not recognized
Browse files Browse the repository at this point in the history
Problem:  filetype: neomuttlog files are not recognized
Solution: detect '*.neomuttdebug' file as neomuttlog filetype,
          include neomuttlog syntax script (Richard Russon)

closes: #15858

Co-authored-by: AvidSeeker <[email protected]>
Signed-off-by: Richard Russon <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
2 people authored and chrisbra committed Oct 13, 2024
1 parent 0f146b7 commit a2aa921
Show file tree
Hide file tree
Showing 7 changed files with 450 additions and 336 deletions.
6 changes: 6 additions & 0 deletions runtime/doc/syntax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2538,6 +2538,12 @@ set "msql_minlines" to the value you desire. Example: >
:let msql_minlines = 200
NEOMUTT *neomutt.vim* *ft-neomuttrc-syntax* *ft-neomuttlog-syntax*

To disable the default NeoMutt log colors >
:let g:neolog_disable_default_colors = 1
N1QL *n1ql.vim* *ft-n1ql-syntax*

N1QL is a SQL-like declarative language for manipulating JSON documents in
Expand Down
3 changes: 3 additions & 0 deletions runtime/doc/tags
Original file line number Diff line number Diff line change
Expand Up @@ -7365,6 +7365,8 @@ ft-msql-syntax syntax.txt /*ft-msql-syntax*
ft-n1ql-syntax syntax.txt /*ft-n1ql-syntax*
ft-nasm-syntax syntax.txt /*ft-nasm-syntax*
ft-ncf-syntax syntax.txt /*ft-ncf-syntax*
ft-neomuttlog-syntax syntax.txt /*ft-neomuttlog-syntax*
ft-neomuttrc-syntax syntax.txt /*ft-neomuttrc-syntax*
ft-nroff-syntax syntax.txt /*ft-nroff-syntax*
ft-ocaml-syntax syntax.txt /*ft-ocaml-syntax*
ft-pandoc-syntax syntax.txt /*ft-pandoc-syntax*
Expand Down Expand Up @@ -8875,6 +8877,7 @@ nb-protocol_errors netbeans.txt /*nb-protocol_errors*
nb-special netbeans.txt /*nb-special*
nb-terms netbeans.txt /*nb-terms*
ncf.vim syntax.txt /*ncf.vim*
neomutt.vim syntax.txt /*neomutt.vim*
netbeans netbeans.txt /*netbeans*
netbeans-commands netbeans.txt /*netbeans-commands*
netbeans-configure netbeans.txt /*netbeans-configure*
Expand Down
3 changes: 3 additions & 0 deletions runtime/filetype.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,9 @@ au BufNewFile,BufRead Mutt{ng,}rc setf muttrc
" N1QL
au BufRead,BufNewfile *.n1ql,*.nql setf n1ql

" Neomutt log
au BufNewFile,BufRead *.neomuttdebug* setf neomuttlog

" Nano
au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc

Expand Down
69 changes: 69 additions & 0 deletions runtime/syntax/neomuttlog.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
" Vim syntax file
" Language: NeoMutt log files
" Maintainer: Richard Russon <[email protected]>
" Last Change: 2024 Oct 12

" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif

syntax match neolog_date "\v^\[\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\] *" conceal
syntax match neolog_version "\v<NeoMutt-\d{8}(-\d+-\x+)*(-dirty)*>"
syntax match neolog_banner "\v^\[\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\] .*" contains=neolog_date,neolog_version
syntax match neolog_function "\v%26v\i+\(\)"

syntax match neolog_perror_key "\v%22v\<P\> " conceal transparent
syntax match neolog_error_key "\v%22v\<E\> " conceal transparent
syntax match neolog_warning_key "\v%22v\<W\> " conceal transparent
syntax match neolog_message_key "\v%22v\<M\> " conceal transparent
syntax match neolog_debug1_key "\v%22v\<1\> " conceal transparent
syntax match neolog_debug2_key "\v%22v\<2\> " conceal transparent
syntax match neolog_debug3_key "\v%22v\<3\> " conceal transparent
syntax match neolog_debug4_key "\v%22v\<4\> " conceal transparent
syntax match neolog_debug5_key "\v%22v\<5\> " conceal transparent
syntax match neolog_notify_key "\v%22v\<N\> " conceal transparent

syntax match neolog_perror "\v%22v\<P\> .*" contains=neolog_perror_key,neolog_function
syntax match neolog_error "\v%22v\<E\> .*" contains=neolog_error_key,neolog_function
syntax match neolog_warning "\v%22v\<W\> .*" contains=neolog_warning_key,neolog_function
syntax match neolog_message "\v%22v\<M\> .*" contains=neolog_message_key,neolog_function
syntax match neolog_debug1 "\v%22v\<1\> .*" contains=neolog_debug1_key,neolog_function
syntax match neolog_debug2 "\v%22v\<2\> .*" contains=neolog_debug2_key,neolog_function
syntax match neolog_debug3 "\v%22v\<3\> .*" contains=neolog_debug3_key,neolog_function
syntax match neolog_debug4 "\v%22v\<4\> .*" contains=neolog_debug4_key,neolog_function
syntax match neolog_debug5 "\v%22v\<5\> .*" contains=neolog_debug5_key,neolog_function
syntax match neolog_notify "\v%22v\<N\> .*" contains=neolog_notify_key,neolog_function

if !exists('g:neolog_disable_default_colors')
highlight neolog_date ctermfg=cyan guifg=#40ffff
highlight neolog_banner ctermfg=magenta guifg=#ff00ff
highlight neolog_version cterm=reverse gui=reverse
highlight neolog_function guibg=#282828

highlight neolog_perror ctermfg=red guifg=#ff8080
highlight neolog_error ctermfg=red guifg=#ff8080
highlight neolog_warning ctermfg=yellow guifg=#ffff80
highlight neolog_message ctermfg=green guifg=#80ff80
highlight neolog_debug1 ctermfg=white guifg=#ffffff
highlight neolog_debug2 ctermfg=white guifg=#ffffff
highlight neolog_debug3 ctermfg=grey guifg=#c0c0c0
highlight neolog_debug4 ctermfg=grey guifg=#c0c0c0
highlight neolog_debug5 ctermfg=grey guifg=#c0c0c0
highlight neolog_notify ctermfg=grey guifg=#c0c0c0
endif

highlight link neolog_perror_key neolog_perror
highlight link neolog_error_key neolog_error
highlight link neolog_warning_key neolog_warning
highlight link neolog_message_key neolog_message
highlight link neolog_debug1_key neolog_debug1
highlight link neolog_debug2_key neolog_debug2
highlight link neolog_debug3_key neolog_debug3
highlight link neolog_debug4_key neolog_debug4
highlight link neolog_debug5_key neolog_debug5
highlight link neolog_notify_key neolog_notify

let b:current_syntax = "neomuttlog"

" vim: ts=2 et tw=100 sw=2 sts=0 ft=vim
Loading

0 comments on commit a2aa921

Please sign in to comment.