diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex index 35f24c656d7..bd2d75cebf8 100644 --- a/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex +++ b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex @@ -1,6 +1,6 @@ %D \module %D [ file=t-syntax-highlight, -%D version=2011.06.14, +%D version=2011.08.10, %D title=\CONTEXT\ User Module, %D subtitle=Code syntax highlighting, %D author=Aditya Mahajan, @@ -20,6 +20,8 @@ \startinterface all \setinterfaceconstant {syntax} {syntax} + \setinterfaceconstant {highlight} {highlight} + \setinterfaceconstant {highlightcolor} {highlightcolor} \stopinterface %D Name space @@ -31,6 +33,10 @@ \installparameterhandler \syntaxhighlighting::namespace \syntaxhighlighting::id \installsetuphandler \syntaxhighlighting::namespace \syntaxhighlighting::id +%D Helper macro + +\def\syntaxhighlighting::yes{\v!yes,\v!on} + \def\definesyntaxhighlighting {\dodoubleargument\syntaxhighlighting::define} @@ -51,6 +57,7 @@ \edef\colorscheme::name{\externalfilterparameter\c!alternative} \let\SYN\syntaxgroup + \let\HGL\syntaxhighlightline \let\\\textbackslash \let\{\textbraceleft \let\}\textbraceright @@ -92,7 +99,7 @@ {\newcount\syntaxhighlighting::linenumber} \startsetups syntaxhighlighting::setup_line_number_mkii -\doif{\externalfilterparameter\c!numbering}\v!yes +\doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes {% setuplinenumbering resets \linenumber. So we save the value of linenumber and % revert it back. \syntaxhighlighting::linenumber=\linenumber @@ -118,7 +125,7 @@ \startmode [\s!mkiv] \starttexdefinition syntaxhighlighting::read_command #1 - \doifelse{\externalfilterparameter\c!numbering}\v!yes + \doifinsetelse{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes {\startlinenumbering [\syntaxhighlighting::name] [\c!continue=\externalfilterparameter{\c!number\c!continue}] @@ -130,8 +137,8 @@ \startmode [\s!mkii] \starttexdefinition syntaxhighlighting::read_command #1 - \doifelse{\externalfilterparameter\c!numbering}\v!yes - {\doifelse{\externalfilterparameter{\c!number\c!continue}}\v!yes + \doifinsetelse{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes + {\doifinsetelse{\externalfilterparameter{\c!number\c!continue}}\syntaxhighlighting::yes {\startlinenumbering[\v!continue]} {\startlinenumbering} \syntaxhighlighting::read_command_aux{#1} @@ -224,6 +231,30 @@ \installspacehandler {\syntaxhighlighting::namespace} {\activatespacehandler {\syntaxhighlighting::namespace\v!off}} +% Line highlighting +% For MkIV, we can use the new bar mechanism to highlight a line. +% For consistency, we use text background, which is slower but works for both +% MkII and MkIV. + +% \startmode[*mkiv] +% \definebar[syntaxhighlightline] +% [\c!order=\v!background, +% \c!rulethickness=2.5, +% \c!offset=1.25, +% \c!continue=\v!yes, +% \c!color=\externalfilterparameter\c!highlightcolor, +% ] +% \stopmode + +\definetextbackground[syntaxhighlightline] + [\c!location=\v!paragraph, + \c!alternative=0, + \c!frame=\v!off, + \c!background=\v!color, + \c!backgroundcolor=\externalfilterparameter\c!highlightcolor, + ] + + \protectmodulecatcodes \stopmodule |