! NEdit Highlighting Patterns for BibTeX ! ! Version 2.2, tested with NEdit 5.4 and 5.5. ! ! http://volker.dnsalias.net/soft/nedit/ ! and perhaps: ! ftp://ftp.nedit.org/pub/NEdit/contrib/highlighting/ ! ! Load this file by starting nedit with: ! ! nedit -import ! ! Then, check that the patterns were loaded correctly, and choose Save Defaults ! from the Preferences menu. The new patterns will now be incorporated into ! your own .nedit file, so the next time you start NEdit, you will no longer ! need to use -import. ! ! ! This language mode is currently called "BibTeX KW", for keyword, because ! certain BibTeX identifiers are highlighted differently. I might make another ! language mode "BibTeX" where that is not the case. Once loaded, language modes ! can be renamed with ! preferences->default settings->syntax highlighting->recognition patterns ! ->add/modify language mode, and editing the name. ! ! NOTE: If you encounter problems with the highlighting being messed up after ! editing, increase the number of context lines to be rescanned after edits. ! This may cost performance, choose what's more important to you. ! See comments in bibtex_kw_test.bib ! ! Copyright (C) 2004-2006 by Volker Kuhlmann , ! and up to 2000: Daniel Blezek, blezek.daniel [at] mayo.edu, and MWE. ! Released under the same license as NEdit itself, ! or, at your option, under the GNU General Public Licence, Version 2. ! ! ChangeLog: ! Original version: Daniel Blezek, blezek.daniel@mayo.edu ! 10 March 2000, Updated for NEdit 5.1 (MWE) ! 30 Dec 2003: Volker Kuhlmann , NEdit 5.4 ! Substantial improvements: ! - Highlighting of month names, digits, and macro names ! - @String definitions now work ! - BibTeX doesn't distinguish between {..} and ".." as field value ! delimiter, therefore there's not much point using different colours ! for the value ! - If the nesting level of braces is exceeded for the field value, things ! break very badly for several entries thereafter. Increased levels ! which are handled correctly from 2 to 4 ! - The standard entry typed and fields are highlighted in a different ! colour ! - Field names are in a different colour if the previous entry is missing ! a trailing comma. ! If you have an idea for how to make this bright read instead, please ! let me know! ! - Removed style "BibTeX Field", using "Keyword" instead ! - Added style "BibTeX newfield", for non-standard entry fields ! (currently set to dark brown, style "plain" might be good choice too) ! - Renamed BracketString to BraceString ! 31 Dec 2003: Volker Kuhlmann ! - The "scroll entry" macro was missing its last line - ooops! ! Thanks to Matthias Odisio for pointing it out. ! - Added more comments to this file. ! - @Preamble now highlighted ! - errornous at-signs in comments are highlighted in bright red ! 2 Jan 2004: Volker Kuhlmann ! Fixed a number of problems pointed out by Jörg Fischer, jf505 at gmx.de ! - Newlines are now allowed as whitespace in most places where BibTeX ! allows them ! - Entry type @comment is highlighted as "standard" instead of "unknown". ! - Field and month names are are now case-insensitive. ! - White space between @ and a "standard" entry type cause the entry to ! be highlighted as "unknown". BibTeX allows this, but says don't do it. ! - Number of lines to be rescanned increased to 4. 8 are sometimes ! necessary. ! - Comment expression removed, as it does nothing anyway. ! 5 Jan 2004: Volker Kuhlmann ! Added some more comments. ! 19 Jul 2006: Volker Kuhlmann ! - Unless Shift+Ctrl+J is called format@BibTeX, LaTeX's key shortcut ! takes precedence. ! - (corrected ftp URL 10Sep06) ! nedit.languageModes: \ BibTeX KW:.bib:::::: nedit.highlightPatterns: \ BibTeX KW:4:0{\n\ Entry:"(?i(?:(?:(@(?:article|book|booklet|inbook|incollection|inproceedings|manual|mastersthesis|misc|phdthesis|proceedings|techreport|unpublished))|(@[\\s\\n]*[a-z][a-z0-9_-]+))[\\s\\n]*[\\{\\(][\\s\\n]*(\\S+)[\\s\\n]*(?=,)|(@string)[\\s\\n]*[\\{\\(][\\s\\n]*(\\S+)[\\s\\n]*=)|(@(?:preamble|comment))[\\s\\n]*[\\{\\(]|(@\\s*[\\w_-]+))":"[})]"::Plain::\n\ StandardType:"\\1\\4\\6":""::BibTeX type:Entry:C\n\ NewType:"\\2":""::Warning:Entry:C\n\ Ref:"\\3\\5":""::Text Key:Entry:C\n\ ErrType:"\\7":""::Flag:Entry:C\n\ Field:",[\\s\\n]*(?i(?:(address|author|booktitle|chapter|crossref|edition|editor|howpublished|institution|journal|key|month|note|number|organization|pages|publisher|school|series|title|type|volume|year))|(\\S+))[\\s\\n]*=":::Plain:Entry:\n\ StandardField:"\\1":""::Keyword:Field:C\n\ NewField:"\\2":""::BibTeX newfield:Field:C\n\ Number:"<[\\d.]+>":::Text Arg1:Entry:\n\ Month:"<(?i(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|([^{"",]+)))>":::Text Arg:Entry:\n\ StringVal:"\\1":""::Text Arg2:Month:C\n\ BraceString:"\\{":"}"::String2:Entry:\n\ QuoteString:"""":""""::String2:Entry:\n\ SubString:"\\{":"}"::String:BraceString:\n\ SubString:"\\{":"}"::String:QuoteString:\n\ Sub2String:"\\{":"}"::String1:SubString:\n\ Sub3String:"\\{":"}"::Plain:Sub2String:\n\ } nedit.styles: \ BibTeX type:blue:Bold Italic\n\ BibTeX newfield:SaddleBrown:Bold !!! Remove these macros if you don't want them. !!! ! File bibtex.nm is also needed and must be loaded from autoload.nm with ! something like ! load_macro_file( getenv("HOME") "/.nedit/bibtex.nm" ) ! Key: Shift+Ctrl+N ! Action: Scrolls the start of the next BibTeX entry to the top of the window. ! ! Key: Shift+Ctrl+P ! Action: Scrolls the start of the previous BibTeX entry to the top of the ! window. ! ! Key: Shift-Ctrl-J ! Action: Re-format BibTeX entry by running it through bibtool. Re-formats ! the selection if there is one, the current entry otherwise. ! nedit.macroCommands: \ scroll next@BibTeX KW:Shift+Ctrl+N::: {\n\ bibtex_scroll_next_entry()\n\ }\n\ scroll prev@BibTeX KW:Shift+Ctrl+P::: {\n\ bibtex_scroll_previous_entry()\n\ }\n\ format@BibTeX KW:Shift+Ctrl+J::: {\n\ bibtex_format_entry()\n\ }\n