summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/context/third/vim/vim.txt31
-rw-r--r--Master/texmf-dist/tex/context/third/vim/2context.vim9
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex81
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkii (renamed from Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex)139
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkiv209
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-vim.tex124
6 files changed, 418 insertions, 175 deletions
diff --git a/Master/texmf-dist/doc/context/third/vim/vim.txt b/Master/texmf-dist/doc/context/third/vim/vim.txt
index b758e998473..9a879a501d2 100644
--- a/Master/texmf-dist/doc/context/third/vim/vim.txt
+++ b/Master/texmf-dist/doc/context/third/vim/vim.txt
@@ -390,6 +390,37 @@ highlighted line will be numbered thrice (with the numbers overprinted on one
another). This is because, internally, highlighting is implemented using text
backgrounds and they do not work with line numbering.
+Using TeX code in Comments
+--------------------------
+
+Sometimes one wants to use TeX code in comments, especially for math. To
+enable this use
+
+ \definevimtyping
+ [...]
+ [...
+ escape=on,
+ ]
+
+When `escape=on`, the `2context.vim` script passes the `Comment` syntax
+region (as identified by `vim`) verbatim to TeX. So, we may use TeX
+commands inside the comment region and they will be interpretted by TeX.
+For example
+
+ \definevimtyping[C][syntax=c, escape=on]
+
+ \startC
+ /* The following function computers the roots of \m{ax^2+bx+c=0}
+ * using the determinant \m{\Delta=\frac{-b\pm\sqrt{b^2-2ac}}{2a}}
+ */
+ double root (double a, double b, double c) {....}
+ \stopC
+
+**Note** that only `\ { }` have their usual meaning inside the `Comment`
+region when `escape=on` is set. Thus, to enter a math expression, use
+`\m{...}` instead of `$...$`. Moreover, spaces are active inside the
+math mode, so, as in the above example, avoid spaces in the math expressions.
+
Tuning color schemes
--------------------
diff --git a/Master/texmf-dist/tex/context/third/vim/2context.vim b/Master/texmf-dist/tex/context/third/vim/2context.vim
index 71c811520db..df192ad8099 100644
--- a/Master/texmf-dist/tex/context/third/vim/2context.vim
+++ b/Master/texmf-dist/tex/context/third/vim/2context.vim
@@ -38,6 +38,11 @@ if !exists("highlight")
let highlight=[]
endif
+" Set escapecomments
+if !exsists("escapecomments")
+ let escapecomments=0
+endif
+
let s:strip = strlen( matchstr( getline(s:lstart), '^\s*' ) )
" Find the smallest leading white space
@@ -92,7 +97,9 @@ while s:lnum <= s:lstop
" we don't need to print in in that case
if strlen(s:temp) > 0
" Change special TeX characters to escape sequences.
- let s:temp = escape( s:temp, '\{}')
+ if !(escapecomments && s:id_name == "Comment")
+ let s:temp = escape( s:temp, '\{}')
+ endif
if !empty(s:id_name)
let s:temp = '\SYN[' . s:id_name . ']{' . s:temp . '}'
endif
diff --git a/Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex b/Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex
index ae1f459b8fa..5efe1719ac4 100644
--- a/Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex
+++ b/Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex
@@ -1,6 +1,6 @@
%D \module
%D [ file=t-syntax-groups,
-%D version=2011.10.20,
+%D version=2011.12.17,
%D title=\CONTEXT\ User Module,
%D subtitle=Syntax highlighting support,
%D author=Aditya Mahajan,
@@ -9,99 +9,100 @@
%D email=adityam <at> ieee <dot> org,
%D license=Simplified BSD License]
-\writestatus{loading}{Syntax highlighting groups (ver: 2011.10.20)}
+\writestatus{loading}{Syntax highlighting groups (ver: 2011.12.17)}
% Colors are specified in hex; in MkII the hex mode needs to be activated.
\doifmode\s!mkii
{\setupcolor[hex]}
-\startmodule [syntax-group]
-\usemodule [module-catcodes]
+\startmodule [syntax-group]
+\usemodule [module-catcodes]
\unprotectmodulecatcodes
-\def\colorscheme::name {}
+\def\colorscheme@name {}
-\def\syntaxgroup::id {syntaxgroup}
-\def\syntaxgroup::namespace {@@@@\syntaxgroup::id}
-\def\syntaxgroup::name {}
+\def\syntaxgroup@id {syntaxgroup}
+\def\syntaxgroup@namespace {@@@@\syntaxgroup@id}
+\def\syntaxgroup@name {}
-\edef\t!syntaxgroup {\syntaxgroup::id}
+\edef\t!syntaxgroup {\syntaxgroup@id}
-
-\installparameterhandler \syntaxgroup::namespace \syntaxgroup::id
-\installsetuphandler \syntaxgroup::namespace \syntaxgroup::id
+\installparameterhandler \syntaxgroup@namespace \syntaxgroup@id
+\installsetuphandler \syntaxgroup@namespace \syntaxgroup@id
+\doifmode{\s!mkiv}
+ {\installstyleandcolorhandler \syntaxgroup@namespace \syntaxgroup@id}
\def\m!syntaxgroup{t-syntax-group}
\def\definesyntaxgroup
- {\dodoubleargument\syntaxgroup::define}
+ {\dodoubleargument\syntaxgroup@define}
-\starttexdefinition syntaxgroup::define [#1][#2]
+\starttexdefinition syntaxgroup@define [#1][#2]
% #1 list name
% #2 options
\doifassignmentelse{#2}
{
- \def\syntaxgroup::get_parameters##1%
+ \def\syntaxgroup@get_parameters##1%
{
- \edef\syntaxgroup::name {\colorscheme::name##1}
- \setupsyntaxgroup[\syntaxgroup::name]
+ \edef\syntaxgroup@name {\colorscheme@name##1}
+ \setupsyntaxgroup[\syntaxgroup@name]
[\c!color=,\c!style=,\c!command=,#2]
\doifsomething{\syntaxgroupparameter\c!color}
{
- \expanded{\definecolor[\syntaxgroup::namespace-##1-color]
+ \expanded{\definecolor[\syntaxgroup@namespace-##1-color]
[\syntaxgroupparameter\c!color]}
- \setupsyntaxgroup[\syntaxgroup::name][\c!color=\syntaxgroup::namespace-##1-color]
+ \setupsyntaxgroup[\syntaxgroup@name][\c!color=\syntaxgroup@namespace-##1-color]
}
}
}{
- \def\syntaxgroup::get_parameters##1%
+ \def\syntaxgroup@get_parameters##1%
{
- \edef\syntaxgroup::name {\colorscheme::name##1}
- \expanded{\setupsyntaxgroup[\syntaxgroup::name]
- [\c!color=\namedsyntaxgroupparameter{\colorscheme::name#2}\c!color,
- \c!style=\namedsyntaxgroupparameter{\colorscheme::name#2}\c!style,
- \c!command=\namedsyntaxgroupparameter{\colorscheme::name#2}\c!command,
+ \edef\syntaxgroup@name {\colorscheme@name##1}
+ \expanded{\setupsyntaxgroup[\syntaxgroup@name]
+ [\c!color=\namedsyntaxgroupparameter{\colorscheme@name#2}\c!color,
+ \c!style=\namedsyntaxgroupparameter{\colorscheme@name#2}\c!style,
+ \c!command=\namedsyntaxgroupparameter{\colorscheme@name#2}\c!command,
]}
% In MkII, \expanded messes up the definition of \currentsyntaxgroup
- \def\currentsyntaxgroup {\syntaxgroup::name}
+ \def\currentsyntaxgroup {\syntaxgroup@name}
}
}
- \processcommalist[#1]\syntaxgroup::get_parameters
+ \processcommalist[#1]\syntaxgroup@get_parameters
\stoptexdefinition
\def\startcolorscheme%
- {\dosingleargument\colorscheme::start}
+ {\dosingleargument\colorscheme@start}
-\starttexdefinition colorscheme::start [#1]
- \pushmacro\colorscheme::name
+\starttexdefinition colorscheme@start [#1]
+ \pushmacro\colorscheme@name
\setcolorscheme{#1}
%\setupsyntaxgroup[\c!color=,\c!style=,\c!command=]
\stoptexdefinition
\def\stopcolorscheme
- {\popmacro\colorscheme::name}
+ {\popmacro\colorscheme@name}
\def\setcolorscheme#1%
- {\edef\colorscheme::name{#1}}
+ {\edef\colorscheme@name{#1}}
\starttexdefinition syntaxgroup [#1]#2
% #1 = style
% #2 = content
\syntaxgroupparameter\c!before
\begingroup
- \edef\syntaxgroup::name{\colorscheme::name#1}%
+ \edef\syntaxgroup@name{\colorscheme@name#1}%
\iftracesyntaxgroups
- \syntaxgroup::show_values
+ \syntaxgroup@show_values
\fi
\doifmode{\s!mkiv}{\dostarttagged\t!syntaxgroup{#1}}
\syntaxgroupparameter\c!command
{
- \externalfilter::attributes_start\syntaxgroup::id\c!style\c!color
+ \externalfilter@attributes_start\syntaxgroup@id\c!style\c!color
#2
- \externalfilter::attributes_stop
+ \externalfilter@attributes_stop
}
\doifmode{\s!mkiv}{\dostoptagged}
\endgroup
@@ -113,11 +114,11 @@
\newif\iftracesyntaxgroups
\let\tracesyntaxgroups\tracesyntaxgroupstrue
-\def\currentsyntaxgroup {\syntaxgroup::name}
+\def\currentsyntaxgroup {\syntaxgroup@name}
-\starttexdefinition syntaxgroup::show_values
- \writestatus\m!syntaxgroup{color scheme : \colorscheme::name}
- \writestatus\m!syntaxgroup{current group: \syntaxgroup::name}
+\starttexdefinition syntaxgroup@show_values
+ \writestatus\m!syntaxgroup{color scheme : \colorscheme@name}
+ \writestatus\m!syntaxgroup{current group: \syntaxgroup@name}
\writestatus\m!syntaxgroup{command : \syntaxgroupparameter\c!command}
\writestatus\m!syntaxgroup{style : \syntaxgroupparameter\c!style}
\writestatus\m!syntaxgroup{color : \syntaxgroupparameter\c!color}
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.mkii
index 09c2ef8e0d0..3119b2c6a00 100644
--- a/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex
+++ b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkii
@@ -1,6 +1,6 @@
%D \module
%D [ file=t-syntax-highlight,
-%D version=2011.10.14,
+%D version=2011.12.17,
%D title=\CONTEXT\ User Module,
%D subtitle=Code syntax highlighting,
%D author=Aditya Mahajan,
@@ -9,12 +9,11 @@
%D email=adityam <at> ieee <dot> org,
%D license=Simplified BSD License]
-\writestatus{loading}{Code syntax highlighting (ver: 2011.10.14)}
+\writestatus{loading}{Code syntax highlighting (ver: 2011.12.17)}
\startmodule [syntax-highlight]
\usemodule [syntax-groups]
-\usemodule [filter]
-\usemodule [module-catcodes]
+\usemodule [filter] % loads module-catcodes
\unprotectmodulecatcodes
@@ -39,37 +38,38 @@
%D Name space
-\def\syntaxhighlighting::id {syntaxhighlighting}
-\def\syntaxhighlighting::namespace {@@@@\syntaxhighlighting::id}
-\def\syntaxhighlighting::name {}
+\def\syntaxhighlighting@id {syntaxhighlighting}
+\def\syntaxhighlighting@namespace {@@@@\syntaxhighlighting@id}
+\def\syntaxhighlighting@name {}
-\edef\t!syntaxhighlighting {\syntaxhighlighting::id}
+\edef\t!syntaxhighlighting {\syntaxhighlighting@id}
-\installparameterhandler \syntaxhighlighting::namespace \syntaxhighlighting::id
-\installsetuphandler \syntaxhighlighting::namespace \syntaxhighlighting::id
+\installparameterhandler \syntaxhighlighting@namespace \syntaxhighlighting@id
+\installsetuphandler \syntaxhighlighting@namespace \syntaxhighlighting@id
%D Helper macro
-\def\syntaxhighlighting::yes{\v!yes,\v!on}
+\def\syntaxhighlighting@yes{\v!yes,\v!on}
\def\definesyntaxhighlighting
- {\dodoubleargument\syntaxhighlighting::define}
+ {\dodoubleargument\syntaxhighlighting@define}
-\starttexdefinition syntaxhighlighting::define [#1][#2]
- \setupsyntaxhighlighting[#1][\s!parent=\syntaxhighlighting::namespace,#2]
+\starttexdefinition syntaxhighlighting@define [#1][#2]
+ \setupsyntaxhighlighting[#1][\s!parent=\syntaxhighlighting@namespace,#2]
- \edef\syntaxhighlighting::name{#1}
- \doifmode\s!mkiv{\setups{syntaxhighlighting::setup_line_number_mkiv}}
+ \edef\syntaxhighlighting@name{#1}
+ \defineexternalfilter[#1][\s!parent=\syntaxhighlighting@namespace#1]
+
+ \doifmode\s!mkiv{\setups{syntaxhighlighting@setup_line_number_mkiv}}
- \defineexternalfilter[#1][\s!parent=\syntaxhighlighting::namespace#1]
\setvalue{type#1file}{\getvalue{process#1file}}
\stoptexdefinition
-\startsetups syntaxhighlighting::setup
+\startsetups syntaxhighlighting@setup
- \edef\syntaxhighlighting::name{\currentexternalfilter}
- \edef\colorscheme::name{\externalfilterparameter\c!alternative}
+ \edef\syntaxhighlighting@name{\currentexternalfilter}
+ \edef\colorscheme@name{\externalfilterparameter\c!alternative}
\let\SYN\syntaxgroup
\let\HGL\syntaxhighlightline
@@ -80,21 +80,21 @@
\def\tab##1%
{\dorecurse{##1}{\obeyedspace}}%
- \doifmode\s!mkii{\setups{syntaxhighlighting::setup_line_number_mkii}}%
+ \doifmode\s!mkii{\setups{syntaxhighlighting@setup_line_number_mkii}}%
\doifinset{\externalfilterparameter\c!option}{\v!packed}
{\setupwhitespace[\v!none,\v!flexible]}%
- \setcatcodetable\externalfilter::minimal_catcodes
+ \setcatcodetable\externalfilter@minimal_catcodes
\expandafter\def\activeendoflinetoken{\strut\par}
- \activatespacehandler{\syntaxhighlighting::namespace\externalfilterparameter\c!space}
+ \activatespacehandler{\syntaxhighlighting@namespace\externalfilterparameter\c!space}
\stopsetups
-\startsetups syntaxhighlighting::setup_line_number_mkiv
- \definelinenumbering [#1]
+\startsetups syntaxhighlighting@setup_line_number_mkiv
+\definelinenumbering [#1]
- \setuplinenumbering
- [\syntaxhighlighting::name]
+\setuplinenumbering
+ [#1]
[\c!conversion=\externalfilterparameter\c!numberconversion,
\c!start=\externalfilterparameter{\c!number\c!start},
\c!step=\externalfilterparameter{\c!number\c!step},
@@ -112,13 +112,13 @@
\stopsetups
\doifmode\s!mkii
- {\newcount\syntaxhighlighting::linenumber}
+ {\newcount\syntaxhighlighting@linenumber}
-\startsetups syntaxhighlighting::setup_line_number_mkii
-\doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes
+\startsetups syntaxhighlighting@setup_line_number_mkii
+\doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
{% setuplinenumbering resets \linenumber. So we save the value of linenumber and
% revert it back.
- \syntaxhighlighting::linenumber=\linenumber
+ \syntaxhighlighting@linenumber=\linenumber
\setuplinenumbering
[\c!conversion=\externalfilterparameter\c!numberconversion,
@@ -136,43 +136,44 @@
\c!align=\externalfilterparameter{\c!number\c!align},
]
- \linenumber=\syntaxhighlighting::linenumber}
+ \linenumber=\syntaxhighlighting@linenumber}
\stopsetups
-\starttexdefinition syntaxhighlighting::read_command #1
- \syntaxhighlighting::linenumbering_start
+\starttexdefinition syntaxhighlighting@read_command #1
+ \syntaxhighlighting@linenumbering_start
\ReadFile{#1}
- \syntaxhighlighting::linenumbering_stop
+ \syntaxhighlighting@linenumbering_stop
\stoptexdefinition
\startmode [\s!mkiv]
-\starttexdefinition syntaxhighlighting::linenumbering_start
- \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes
+\starttexdefinition syntaxhighlighting@linenumbering_start
+ \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
{\startlinenumbering
- [\syntaxhighlighting::name]
+ [\syntaxhighlighting@name]
[\c!continue=\externalfilterparameter{\c!number\c!continue}]}
+ \dostarttagged\t!syntaxhighlighting\colorscheme@name
\stoptexdefinition
-\starttexdefinition syntaxhighlighting::linenumbering_stop
+\starttexdefinition syntaxhighlighting@linenumbering_stop
\dostoptagged
- \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes
+ \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
{\stoplinenumbering}
\stoptexdefinition
\stopmode
\startmode [\s!mkii]
-\starttexdefinition syntaxhighlighting::linenumbering_start
- \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes
- {\doifelse{\externalfilterparameter{\c!number\c!continue}}\syntaxhighlighting::yes
+\starttexdefinition syntaxhighlighting@linenumbering_start
+ \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
+ {\doifelse{\externalfilterparameter{\c!number\c!continue}}\syntaxhighlighting@yes
{\startlinenumbering[\v!continue]}
{\startlinenumbering}}
\stoptexdefinition
-
-\starttexdefinition syntaxhighlighting::linenumbering_stop
- \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting::yes
+\starttexdefinition syntaxhighlighting@linenumbering_stop
+ \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
{\stoplinenumbering}
\stoptexdefinition
+
\stopmode
\setupsyntaxhighlighting
@@ -190,11 +191,11 @@
\c!filtercommand=echo, % placeholder
\c!continue=yes,
\c!read=\v!yes,
- \c!readcommand=\syntaxhighlighting::read_command,
+ \c!readcommand=\syntaxhighlighting@read_command,
\c!output=\externalfilterinputfile, % placeholder
- \c!setups=syntaxhighlighting::setup,
+ \c!setups=syntaxhighlighting@setup,
\c!option=\v!packed, % Could be a list
- \s!parent=\externalfilter::namespace,
+ \s!parent=\externalfilter@namespace,
% Numbering options
\c!numbering=\v!no,
\c!number\c!start=1,
@@ -213,54 +214,41 @@
\c!number\c!align=\v!flushright,
]
-\def\currentsyntaxhighlighting {\syntaxhighlighting::name}
+\def\currentsyntaxhighlighting {\syntaxhighlighting@name}
% Space handler
%
% The space handing code for MkII and MkIV is not consistent. So, we provide our
% own versions.
-\setvalue{\syntaxhighlighting::namespace ::\c!lines ::\v!split}{\hskip}
-\setvalue {\syntaxhighlighting::namespace ::\c!lines ::\v!fixed}{\dontleavehmode\kern}
+\setvalue{\syntaxhighlighting@namespace @\c!lines @\v!split}{\hskip}
+\setvalue {\syntaxhighlighting@namespace @\c!lines @\v!fixed}{\dontleavehmode\kern}
% default
-\setvalue{\syntaxhighlighting::namespace ::\c!lines ::}{\hskip}
+\setvalue{\syntaxhighlighting@namespace @\c!lines @}{\hskip}
-\def\syntaxhighlighting::split%
- {\getvalue{\syntaxhighlighting::namespace ::\c!lines ::\externalfilterparameter\c!lines}}
+\def\syntaxhighlighting@split%
+ {\getvalue{\syntaxhighlighting@namespace @\c!lines @\externalfilterparameter\c!lines}}
% Visible space
-\installspacehandler {\syntaxhighlighting::namespace\v!on}
+\installspacehandler {\syntaxhighlighting@namespace\v!on}
{\obeyspaces
\unexpanded\def\obeyedspace
- {\syntaxhighlighting::split\zeropoint\relax
+ {\syntaxhighlighting@split\zeropoint\relax
\hbox{\normalcontrolspace}%
- \syntaxhighlighting::split\zeropoint\relax}}%
+ \syntaxhighlighting@split\zeropoint\relax}}%
% Invisible space
-\installspacehandler {\syntaxhighlighting::namespace\v!off}
+\installspacehandler {\syntaxhighlighting@namespace\v!off}
{\obeyspaces
\unexpanded\def\obeyedspace
- {\syntaxhighlighting::split\interwordspace\relax}}
+ {\syntaxhighlighting@split\interwordspace\relax}}
% Default
-\installspacehandler {\syntaxhighlighting::namespace}
- {\activatespacehandler {\syntaxhighlighting::namespace\v!off}}
+\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,
@@ -268,6 +256,7 @@
\c!frame=\v!off,
\c!background=\v!color,
\c!backgroundcolor=\externalfilterparameter\c!highlightcolor,
+ \c!after=,
]
diff --git a/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkiv b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkiv
new file mode 100644
index 00000000000..20ed5ebe7d3
--- /dev/null
+++ b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkiv
@@ -0,0 +1,209 @@
+%D \module
+%D [ file=t-syntax-highlight,
+%D version=2011.12.17,
+%D title=\CONTEXT\ User Module,
+%D subtitle=Code syntax highlighting,
+%D author=Aditya Mahajan,
+%D date=\currentdate,
+%D copyright=Aditya Mahajan,
+%D email=adityam <at> ieee <dot> org,
+%D license=Simplified BSD License]
+
+\writestatus{loading}{Code syntax highlighting (ver: 2011.12.17)}
+
+\startmodule [syntax-highlight]
+\usemodule [syntax-groups]
+\usemodule [filter] % loads module-catcodes
+
+\unprotectmodulecatcodes
+
+\startinterface all
+ \setinterfaceconstant {syntax} {syntax}
+ \setinterfaceconstant {highlight} {highlight}
+ \setinterfaceconstant {highlightcolor} {highlightcolor}
+\stopinterface
+
+%D Name space
+
+\def\syntaxhighlighting@id {syntaxhighlighting}
+\def\syntaxhighlighting@namespace {@@@@\syntaxhighlighting@id}
+\def\syntaxhighlighting@name {}
+
+\edef\t!syntaxhighlighting {\syntaxhighlighting@id}
+
+\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}
+
+\starttexdefinition syntaxhighlighting@define [#1][#2]
+ \setupsyntaxhighlighting[#1][\s!parent=\syntaxhighlighting@namespace,#2]
+
+ \edef\syntaxhighlighting@name{#1}
+ \defineexternalfilter[#1][\s!parent=\syntaxhighlighting@namespace#1]
+
+ \setups{syntaxhighlighting@setup_line_number_mkiv}
+
+ \setvalue{type#1file}{\getvalue{process#1file}}
+
+\stoptexdefinition
+
+\startsetups syntaxhighlighting@setup
+
+ \edef\syntaxhighlighting@name{\currentexternalfilter}
+ \edef\colorscheme@name{\externalfilterparameter\c!alternative}
+
+ \let\SYN\syntaxgroup
+ \let\HGL\syntaxhighlightline
+ \let\\\textbackslash
+ \let\{\textbraceleft
+ \let\}\textbraceright
+
+ \setupbar[syntaxhighlightline][color=\externalfilterparameter\c!highlightcolor]
+
+ \def\tab##1%
+ {\dorecurse{##1}{\obeyedspace}}%
+
+ \doifinset{\externalfilterparameter\c!option}{\v!packed}
+ {\setupwhitespace[\v!none,\v!flexible]}%
+
+ \setcatcodetable\externalfilter@minimal_catcodes
+ \expandafter\def\activeendoflinetoken{\strut\par}
+ \activatespacehandler{\syntaxhighlighting@namespace\externalfilterparameter\c!space}
+\stopsetups
+
+\startsetups syntaxhighlighting@setup_line_number_mkiv
+\definelinenumbering [#1]
+
+\setuplinenumbering
+ [#1]
+ [\c!conversion=\externalfilterparameter\c!numberconversion,
+ \c!start=\externalfilterparameter{\c!number\c!start},
+ \c!step=\externalfilterparameter{\c!number\c!step},
+ \c!method=\externalfilterparameter{\c!number\c!method},
+ \c!location=\externalfilterparameter{\c!number\c!location},
+ \c!style=\externalfilterparameter\c!numberstyle,
+ \c!color=\externalfilterparameter\c!numbercolor,
+ \c!width=\externalfilterparameter{\c!number\c!width},
+ \c!left=\externalfilterparameter{\c!number\c!left},
+ \c!right=\externalfilterparameter{\c!number\c!right},
+ \c!command=\externalfilterparameter\c!numbercommand,
+ \c!distance=\externalfilterparameter{\c!number\c!distance},
+ \c!align=\externalfilterparameter{\c!number\c!align},
+ ]
+\stopsetups
+
+\starttexdefinition syntaxhighlighting@read_command #1
+ \syntaxhighlighting@linenumbering_start
+ \ReadFile{#1}
+ \syntaxhighlighting@linenumbering_stop
+\stoptexdefinition
+
+\starttexdefinition syntaxhighlighting@linenumbering_start
+ \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
+ {\startlinenumbering
+ [\syntaxhighlighting@name]
+ [\c!continue=\externalfilterparameter{\c!number\c!continue}]}
+ \dostarttagged\t!syntaxhighlighting\colorscheme@name
+\stoptexdefinition
+
+\starttexdefinition syntaxhighlighting@linenumbering_stop
+ \dostoptagged
+ \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
+ {\stoplinenumbering}
+\stoptexdefinition
+
+
+\setupsyntaxhighlighting
+ [\c!tab=4,
+ \c!space=\v!off,
+ \c!lines=\v!split,
+ \c!start=1,
+ \c!stop=0,
+ % \c!syntax=context,
+ \c!alternative=pscolor,
+ \c!before=\blank,
+ \c!after=\blank,
+ \c!style=\tttf,
+ \c!color=,
+ \c!filtercommand=echo, % placeholder
+ \c!continue=yes,
+ \c!read=\v!yes,
+ \c!readcommand=\syntaxhighlighting@read_command,
+ \c!output=\externalfilterinputfile, % placeholder
+ \c!setups=syntaxhighlighting@setup,
+ \c!option=\v!packed, % Could be a list
+ \s!parent=\externalfilter@namespace,
+ % Numbering options
+ \c!numbering=\v!no,
+ \c!number\c!start=1,
+ \c!number\c!step=1,
+ \c!number\c!continue=\v!no,
+ \c!numberconversion=\v!numbers,
+ \c!number\c!method=\v!first,
+ \c!number\c!location=\v!left,
+ \c!numberstyle=\ttx,
+ \c!numbercolor=,
+ \c!number\c!width=2em,
+ \c!number\c!left=,
+ \c!number\c!right=,
+ \c!number\c!command=,
+ \c!number\c!distance=0.5em,
+ \c!number\c!align=\v!flushright,
+ ]
+
+\def\currentsyntaxhighlighting {\syntaxhighlighting@name}
+
+% Space handler
+%
+% The space handing code for MkII and MkIV is not consistent. So, we provide our
+% own versions.
+
+\setvalue{\syntaxhighlighting@namespace::\c!lines::\v!split}{\hskip}
+\setvalue {\syntaxhighlighting@namespace::\c!lines::\v!fixed}{\dontleavehmode\kern}
+
+% default
+\setvalue{\syntaxhighlighting@namespace::\c!lines::}{\hskip}
+
+\def\syntaxhighlighting@split%
+ {\getvalue{\syntaxhighlighting@namespace::\c!lines::\externalfilterparameter\c!lines}}
+
+% Visible space
+\installspacehandler {\syntaxhighlighting@namespace\v!on}
+ {\obeyspaces
+ \unexpanded\def\obeyedspace
+ {\syntaxhighlighting@split\zeropoint\relax
+ \hbox{\normalcontrolspace}%
+ \syntaxhighlighting@split\zeropoint\relax}}%
+
+% Invisible space
+\installspacehandler {\syntaxhighlighting@namespace\v!off}
+ {\obeyspaces
+ \unexpanded\def\obeyedspace
+ {\syntaxhighlighting@split\interwordspace\relax}}
+
+% Default
+\installspacehandler {\syntaxhighlighting@namespace}
+ {\activatespacehandler {\syntaxhighlighting@namespace\v!off}}
+
+% Line highlighting
+
+\definebar[syntaxhighlightline]
+ [\c!order=\v!background,
+ \c!rulethickness=2.5,
+ \c!method=0,
+ \c!offset=1.375,
+ \c!continue=\v!yes,
+ \c!color=\externalfilterparameter\c!highlightcolor,
+ ]
+
+
+\protectmodulecatcodes
+
+\stopmodule
+
diff --git a/Master/texmf-dist/tex/context/third/vim/t-vim.tex b/Master/texmf-dist/tex/context/third/vim/t-vim.tex
index 2c6fd86d241..408c9c80003 100644
--- a/Master/texmf-dist/tex/context/third/vim/t-vim.tex
+++ b/Master/texmf-dist/tex/context/third/vim/t-vim.tex
@@ -1,6 +1,6 @@
%D \module
%D [ file=t-vim,
-%D version=2011.12.04,
+%D version=2011.12.17,
%D title=\CONTEXT\ User Module,
%D subtitle=Vim syntax highlighting,
%D author=Aditya Mahajan,
@@ -9,13 +9,11 @@
%D email=adityam <at> ieee <dot> org,
%D license=Simplified BSD License]
-\writestatus{loading}{Vim syntax highlighting (ver: 2011.12.04)}
+\writestatus{loading}{Vim syntax highlighting (ver: 2011.12.17)}
-\startmodule [vim]
-\usemodule [filter]
-\usemodule [syntax-highlight]
-\usemodule [syntax-groups]
-\usemodule [module-catcodes]
+\startmodule [vim]
+\usemodule [filter] % loads module catcodes
+\usemodule [syntax-highlight] % loads syntax-groups and filter module
\startinterface all
\setinterfaceconstant {vimrc} {vimrc}
@@ -23,88 +21,87 @@
\unprotectmodulecatcodes
-\def\vimtyping::id {vimtyping}
-\def\vimtyping::namespace {@@@@\vimtyping::id}
-\def\vimtyping::name {}
+\def\vimtyping@id {vimtyping}
+\def\vimtyping@namespace {@@@@\vimtyping@id}
+\def\vimtyping@name {}
-\def\vimrc::id {vimrc}
+\def\vimrc@id {vimrc}
-\installparameterhandler \vimtyping::namespace \vimtyping::id
-\installsetuphandler \vimtyping::namespace \vimtyping::id
+\installparameterhandler \vimtyping@namespace \vimtyping@id
+\installsetuphandler \vimtyping@namespace \vimtyping@id
\def\definevimtyping
- {\dodoubleargument\vimtyping::define}
+ {\dodoubleargument\vimtyping@define}
-\starttexdefinition vimtyping::define [#1][#2]
- \setupvimtyping[#1][\s!parent=\vimtyping::namespace,#2]
+\starttexdefinition vimtyping@define [#1][#2]
+ \setupvimtyping[#1][\s!parent=\vimtyping@namespace,#2]
- \edef\vimtyping::name{#1}
+ \edef\vimtyping@name{#1}
- \definesyntaxhighlighting[#1][\s!parent=\vimtyping::namespace#1]
+ \definesyntaxhighlighting[#1][\s!parent=\vimtyping@namespace#1]
- \setvalue{\e!start raw#1}{\bgroup\obeylines\dodoubleargument\vimtyping::start_raw[#1]}
- \setvalue{\e!stop raw#1}{\vimtyping::stop_raw}
- \setvalue{inlineraw#1}{\dodoubleargument\vimtyping::inline_raw[#1]}
+ \setvalue{\e!start raw#1}{\bgroup\obeylines\dodoubleargument\vimtyping@start_raw[#1]}
+ \setvalue{\e!stop raw#1}{\vimtyping@stop_raw}
+ \setvalue{inlineraw#1}{\dodoubleargument\vimtyping@inline_raw[#1]}
\stoptexdefinition
-\starttexdefinition vimtyping::start_raw [#1][#2]
+\starttexdefinition vimtyping@start_raw [#1][#2]
% #1 = filter
% #2 = options
\egroup %\bgroup in \start#1
- \edef\vimtyping::name{#1}
+ \edef\vimtyping@name{#1}
\begingroup % to keep assignments local
\setupvimtyping[#1][\c!name=,#2]
\externalfilterparameter\c!before
- \externalfilter::attributes_start \externalfilter::id \c!style \c!color
- \syntaxhighlighting::linenumbering_start
+ \externalfilter@attributes_start \externalfilter@id \c!style \c!color
+ \syntaxhighlighting@linenumbering_start
\processcommacommand[\externalfilterparameter\c!setups]\directsetup
- \gobbleoneargument % The next argument is \type{^M}, so we gobble it
+ \gobbleoneargument % For some reason the next argument is
\stoptexdefinition
-\starttexdefinition vimtyping::stop_raw
+\starttexdefinition vimtyping@stop_raw
- \syntaxhighlighting::linenumbering_stop
- \externalfilter::attributes_stop
+ \syntaxhighlighting@linenumbering_stop
+ \externalfilter@attributes_stop
\externalfilterparameter\c!after
\endgroup
\stoptexdefinition
-\starttexdefinition vimtyping::inline_raw [#1][#2]
+\starttexdefinition vimtyping@inline_raw [#1][#2]
% #1 = filter
% #2 = options
- \edef\vimtyping::name{#1}
+ \edef\vimtyping@name{#1}
\begingroup % to keep assignments local
\setupvimtyping[#1][\c!name=,\c!before=,\c!after=,#2]
- \externalfilter::attributes_start \externalfilter::id \c!style \c!color
+ \externalfilter@attributes_start \externalfilter@id \c!style \c!color
% We assume that the setups set minimal_catcodes
\processcommacommand[\externalfilterparameter\c!setups]\directsetup
- \vimtyping::inline_raw_aux
+ \vimtyping@inline_raw_indeed
\stoptexdefinition
-\starttexdefinition vimtyping::inline_raw_aux #1
+\starttexdefinition vimtyping@inline_raw_indeed #1
#1
- \externalfilter::attributes_stop
+ \externalfilter@attributes_stop
\endgroup
\stoptexdefinition
-
% Mode to testing the dev version of 2context script.
\doifmodeelse{vim-dev}
- {\def\vimtyping::script_name{2context.vim}}
- {\doifmode\s!mkiv
- {\ctxlua{context.setvalue("vimtyping::script_name",resolvers.resolve("full:2context.vim"))}}
- {\def\vimtyping::script_name{kpse:2context.vim}}}
+ {\def\vimtyping@script_name{2context.vim}}
+ {\doifmodeelse\s!mkiv
+ {\ctxlua{context.setvalue("vimtyping@script_name",resolvers.resolve("full:2context.vim"))}}
+ {\def\vimtyping@script_name{kpse:2context.vim}}}
-\def\vimtyping::filter_command
+\def\vimtyping@filter_command
{vim -u \vimrcfilename\space % read global config file
--noplugin % dont load plugins
-e % run in ex mode
@@ -116,19 +113,27 @@
-c "set syntax=\externalfilterparameter\c!syntax" %
-c "let contextstartline=\externalfilterparameter\c!start" %
-c "let contextstopline=\externalfilterparameter\c!stop" %
- -c "let strip=\getvalue{\vimtyping::id-\c!strip-\externalfilterparameter\c!strip}" %
+ -c "let strip=\getvalue{\vimtyping@id-\c!strip-\externalfilterparameter\c!strip}" %
+ -c "let escapecomments=\getvalue{\vimtyping@id-\c!escape-\externalfilterparameter\c!escape}" %
-c "let highlight=[\externalfilterparameter\c!highlight]" %
- -c "source \vimtyping::script_name" %
+ -c "source \vimtyping@script_name" %
-c "qa" %
\externalfilterinputfile\space
\externalfilteroutputfile}
-\setvalue{\vimtyping::id-\c!strip-\v!off}{0}
-\setvalue{\vimtyping::id-\c!strip-\v!on}{1}
+\setvalue{\vimtyping@id-\c!strip-\v!off}{0}
+\setvalue{\vimtyping@id-\c!strip-\v!on}{1}
+
+\setvalue{\vimtyping@id-\c!escape-\v!off}{0}
+\setvalue{\vimtyping@id-\c!escape-\v!on}{1}
+
% Undocumented ... but useful if the user makes a mistake
-\setvalue{\vimtyping::id-\c!strip-\v!no}{0}
-\setvalue{\vimtyping::id-\c!strip-\v!yes}{1}
+\setvalue{\vimtyping@id-\c!strip-\v!no}{0}
+\setvalue{\vimtyping@id-\c!strip-\v!yes}{1}
+
+\setvalue{\vimtyping@id-\c!escape-\v!no}{0}
+\setvalue{\vimtyping@id-\c!escape-\v!yes}{1}
\setupvimtyping
[% \c!tab=4,
@@ -141,17 +146,18 @@
% \c!style=\tttf,
% \c!color=,
\c!strip=\v!off,
+ \c!escape=\v!off,
\c!highlight=,
\c!highlightcolor=lightgray,
- \c!filtercommand=\vimtyping::filter_command,
+ \c!filtercommand=\vimtyping@filter_command,
% \c!continue=yes,
% \c!read=\v!yes,
- % \c!readcommand=\syntaxhighlighting::read_command,
+ % \c!readcommand=\syntaxhighlighting@read_command,
\c!output=\externalfilterbasefile.vimout,
- %\c!setups=syntaxhighlighting::setup,
- \c!filter\c!setups=vimrc::setup,
+ %\c!setups=syntaxhighlighting@setup,
+ \c!filter\c!setups=vimrc@setup,
% \c!option=\v!packed, % Could be a list
- \s!parent=\syntaxhighlighting::namespace,
+ \s!parent=\syntaxhighlighting@namespace,
\c!vimrc=,
% % Numbering options
% \c!numbering=\v!no,
@@ -171,26 +177,26 @@
% \c!number\c!align=\v!flushright,
]
-\def\currentvimtyping {\vimtyping::name}
+\def\currentvimtyping {\vimtyping@name}
\defineexternalfilter
- [\vimrc::id]
+ [\vimrc@id]
[\c!continue=\v!no,
\c!read=\v!no,
\c!filtercommand=\empty]
\def\vimrcfilename{NONE}
-\startsetups vimrc::setup
+\startsetups vimrc@setup
\doifelsenothing{\externalfilterparameter\c!vimrc}
{\def\vimrcfilename{NONE}}
{\begingroup
- \expanded{\setupexternalfilter[\vimrc::id][\c!name=\externalfilterparameter\c!vimrc]}
+ \expanded{\setupexternalfilter[\vimrc@id][\c!name=\externalfilterparameter\c!vimrc]}
- \edef\externalfilter::name{\vimrc::id}
- \externalfilter::set_filenames
+ \edef\externalfilter@name{\vimrc@id}
+ \externalfilter@set_filenames
- \global\xdef\vimrcfilename{\externalfilter::input_file}
+ \global\xdef\vimrcfilename{\externalfilter@input_file}
\endgroup
}
\stopsetups