Patch for bib.vim to implement correct BibTeX "comment"
highlighting (Re: Bug#316184: vim-common: incomplet bibtex
syntax file)
Bernd Feige
charly at pst15.ukl.uni-freiburg.de
Fri Aug 19 12:59:13 UTC 2005
Dear Bram & Colleagues,
the attached patch contributed by Stefano of the debian project fixes the BibTeX syntax
to do comment highlighting according to both of BibTeX's somewhat unusual rules:
- Everything between BibTeX entries is a comment (This was implemented previously but broken)
- A special BibTeX entry @comment{...} is a comment.
Best regards,
Bernd
-------------- next part --------------
*** bib.vim 2001/09/03 12:30:36 1.16.2.1.2.18
--- bib.vim 2005/08/03 09:25:46
***************
*** 2,9 ****
" Language: BibTeX (bibliographic database format for (La)TeX)
" Maintainer: Bernd Feige <Bernd.Feige at gmx.net>
" Filenames: *.bib
! " Last Change: Apr 26, 2001
! " URL: http://home.t-online.de/home/Bernd.Feige/bib.vim
" Thanks to those who pointed out problems with this file or supplied fixes!
--- 2,8 ----
" Language: BibTeX (bibliographic database format for (La)TeX)
" Maintainer: Bernd Feige <Bernd.Feige at gmx.net>
" Filenames: *.bib
! " Last Change: Aug 02, 2005
" Thanks to those who pointed out problems with this file or supplied fixes!
***************
*** 47,53 ****
syn match bibUnescapedSpecial contained /[^\\][%&]/hs=s+1
syn match bibKey contained /\s*[^ \t}="]\+,/hs=s,he=e-1 nextgroup=bibField
syn match bibVariable contained /[^{}," \t=]/
! syn region bibComment start=/^/ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
syn region bibQuote contained start=/"/ end=/"/ skip=/\(\\"\)/ contains=@bibVarContents
syn region bibBrace contained start=/{/ end=/}/ skip=/\(\\[{}]\)/ contains=@bibVarContents
syn region bibParen contained start=/(/ end=/)/ skip=/\(\\[()]\)/ contains=@bibVarContents
--- 46,52 ----
syn match bibUnescapedSpecial contained /[^\\][%&]/hs=s+1
syn match bibKey contained /\s*[^ \t}="]\+,/hs=s,he=e-1 nextgroup=bibField
syn match bibVariable contained /[^{}," \t=]/
! syn region bibComment start=/./ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
syn region bibQuote contained start=/"/ end=/"/ skip=/\(\\"\)/ contains=@bibVarContents
syn region bibBrace contained start=/{/ end=/}/ skip=/\(\\[{}]\)/ contains=@bibVarContents
syn region bibParen contained start=/(/ end=/)/ skip=/\(\\[()]\)/ contains=@bibVarContents
***************
*** 60,65 ****
--- 59,65 ----
else
syn region bibEntry start=/@\S\+[{(]/ end=/^\s*[})]/ transparent fold contains=bibType,bibEntryData nextgroup=bibComment
endif
+ syn region bibComment2 start=/@Comment[{(]/ end=/^\s*@/me=e-1 contains=@bibCommentContents nextgroup=bibEntry
" Synchronization
" ===============
***************
*** 86,91 ****
--- 86,92 ----
HiLink bibVariable Constant
HiLink bibUnescapedSpecial Error
HiLink bibComment Comment
+ HiLink bibComment2 Comment
delcommand HiLink
endif
More information about the pkg-vim-maintainers
mailing list