summaryrefslogtreecommitdiff
path: root/macros/context/contrib/context-vim/tex/context/third/vim/t-syntax-highlight.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'macros/context/contrib/context-vim/tex/context/third/vim/t-syntax-highlight.mkiv')
-rw-r--r--macros/context/contrib/context-vim/tex/context/third/vim/t-syntax-highlight.mkiv63
1 files changed, 39 insertions, 24 deletions
diff --git a/macros/context/contrib/context-vim/tex/context/third/vim/t-syntax-highlight.mkiv b/macros/context/contrib/context-vim/tex/context/third/vim/t-syntax-highlight.mkiv
index a056730174..13786bba29 100644
--- a/macros/context/contrib/context-vim/tex/context/third/vim/t-syntax-highlight.mkiv
+++ b/macros/context/contrib/context-vim/tex/context/third/vim/t-syntax-highlight.mkiv
@@ -1,6 +1,6 @@
%D \module
%D [ file=t-syntax-highlight,
-%D version=2018.08.10,
+%D version=2020.06.29,
%D title=\CONTEXT\ User Module,
%D subtitle=Code syntax highlighting,
%D author=Aditya Mahajan,
@@ -9,7 +9,7 @@
%D email=adityam <at> ieee <dot> org,
%D license=Simplified BSD License]
-\writestatus{loading}{Code syntax highlighting (ver: 2018.08.10)}
+\writestatus{loading}{Code syntax highlighting (ver: 2020.06.29)}
\startmodule [syntax-highlight]
\usemodule [syntax-groups]
@@ -36,32 +36,37 @@
\appendtoks
\defineexternalfilter[\currentsyntaxhighlighting]
- [\s!parent=\????syntaxhighlighting\currentexternalfilter,\c!taglabel=\vimtyping@id]%
+ [\s!parent=\????syntaxhighlighting\currentexternalfilter,
+ \c!taglabel=\vimtyping@id,
+ \c!tagdetail={\externalfilterparameter\c!alternative},
+ ]%
\normalexpanded{\definelinenumbering [\currentsyntaxhighlighting]}%
\setevalue{type\currentsyntaxhighlighting file}{\getvalue{process\currentsyntaxhighlighting file}}%
\to\everydefinesyntaxhighlighting
+\define[1]\syntaxhighlighting@set_linenumbers
+ {\def\syntaxhighlighting@linenumbering{\getvalue{current#1}}%
+ \def\syntaxhighlighting@parameter{\getvalue{#1parameter}}%
+ \normalexpanded{\setuplinenumbering[\syntaxhighlighting@linenumbering]
+ [
+ \c!method=\syntaxhighlighting@parameter{\c!number\c!method},
+ \c!conversion=\syntaxhighlighting@parameter\c!numberconversion,
+ \c!location=\syntaxhighlighting@parameter{\c!number\c!location},
+ \c!style=\syntaxhighlighting@parameter\c!numberstyle,
+ \c!color=\syntaxhighlighting@parameter\c!numbercolor,
+ \c!width=\syntaxhighlighting@parameter{\c!number\c!width},
+ \c!left=\syntaxhighlighting@parameter{\c!number\c!left},
+ \c!right=\syntaxhighlighting@parameter{\c!number\c!right},
+ \c!command=\syntaxhighlighting@parameter\c!numbercommand,
+ \c!distance=\syntaxhighlighting@parameter{\c!number\c!distance},
+ \c!align=\syntaxhighlighting@parameter{\c!number\c!align},
+ ]}}
+
\appendtoks
- % \externalfitlterparameter does not work, so it is better to use
- % \syntaxhighlighting parameter.
- \normalexpanded{\setuplinenumbering[\currentsyntaxhighlighting]
- [
- \c!method=\syntaxhighlightingparameter{\c!number\c!method},
- \c!conversion=\syntaxhighlightingparameter\c!numberconversion,
- \c!location=\syntaxhighlightingparameter{\c!number\c!location},
- \c!style=\syntaxhighlightingparameter\c!numberstyle,
- \c!color=\syntaxhighlightingparameter\c!numbercolor,
- \c!width=\syntaxhighlightingparameter{\c!number\c!width},
- \c!left=\syntaxhighlightingparameter{\c!number\c!left},
- \c!right=\syntaxhighlightingparameter{\c!number\c!right},
- \c!command=\syntaxhighlightingparameter\c!numbercommand,
- \c!distance=\syntaxhighlightingparameter{\c!number\c!distance},
- \c!align=\syntaxhighlightingparameter{\c!number\c!align},
- ]}%
+ \syntaxhighlighting@set_linenumbers\syntaxhighlighting@id
\to\everysetupsyntaxhighlighting
\def\syntaxhighlighting@id {syntaxhighlighting}
-\edef\t!syntaxhighlighting {\syntaxhighlighting@id}
%D Helper macro
@@ -111,7 +116,7 @@
\stoptexdefinition
\starttexdefinition syntaxhighlighting@linenumbering_start
- \doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
+ \doifinsetelse{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
{\let\SYNBOL=\syntaxhighlighting_begin_number_lines
\let\SYNEOL=\syntaxhighlighting_end_number_lines
\startlinenumbering
@@ -122,24 +127,34 @@
\c!step=\externalfilterparameter{\c!number\c!step},
\c!continue=\externalfilterparameter{\c!number\c!continue},
]}
- \dostarttagged\t!syntaxhighlighting\colorscheme@name
+ {\let\SYNBOL=\syntaxhighlighting_begin_lines
+ \let\SYNEOL=\syntaxhighlighting_end_lines}
\stoptexdefinition
\starttexdefinition syntaxhighlighting@linenumbering_stop
- \dostoptagged
\doifinset{\externalfilterparameter\c!numbering}\syntaxhighlighting@yes
{\stoplinenumbering}
\stoptexdefinition
\newcount\nofsyntaxhighlightinglines
+\starttexdefinition syntaxhighlighting_begin_lines
+ \dostarttaggednodetail\t!verbatimline
+\stoptexdefinition
+
+\starttexdefinition syntaxhighlighting_end_lines
+ \dostoptagged
+\stoptexdefinition
+
\starttexdefinition syntaxhighlighting_begin_number_lines
\global\advance\nofsyntaxhighlightinglines\plusone
+ \dostarttaggednodetail\t!verbatimline
\attribute\verbatimlineattribute\nofsyntaxhighlightinglines
\stoptexdefinition
\starttexdefinition syntaxhighlighting_end_number_lines
- \attribute\verbatimlineattribute\attributeunsetvalue
+ \attribute\verbatimlineattribute\attributeunsetvalue
+ \dostoptagged
\stoptexdefinition