summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-06-28 21:33:59 +0000
committerKarl Berry <karl@freefriends.org>2011-06-28 21:33:59 +0000
commit47938a882aac64c9cb55a98819fe3a107dc852c3 (patch)
tree9687bfe5ecadc19094fe0d6fcbfd2635c0bac4a2 /Master/texmf-dist/tex
parentc802db8128853e177e1ca863dd76c994599b28b6 (diff)
context-vim update per author
git-svn-id: svn://tug.org/texlive/trunk@23166 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/context/third/vim/2context.vim51
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex94
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex230
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-vim.tex403
4 files changed, 489 insertions, 289 deletions
diff --git a/Master/texmf-dist/tex/context/third/vim/2context.vim b/Master/texmf-dist/tex/context/third/vim/2context.vim
index a90fc0719c4..0e29c46c5bf 100644
--- a/Master/texmf-dist/tex/context/third/vim/2context.vim
+++ b/Master/texmf-dist/tex/context/third/vim/2context.vim
@@ -3,53 +3,44 @@
" license : Simplified BSD License
" This script is part of the t-vim module for ConTeXt. It is based on 2html.vim.
-" It assumes that two buffers are open. The first buffer is the input buffer,
-" and the second buffer is the output buffer.
+" Since this script is called by the t-vim module, we assume that Two buffers
+" are open. The first buffer is the input buffer, and the second buffer is the
+" output buffer. The script parses content line-by-line from the first buffer
+" and pastes the modified result on the second buffer.
-" We move back and forth between the buffers,
-
-" Split and go to the last buffer
+" Split screen and go to the second buffer, ensure modifiable is set, and the
+" buffer is empty.
sblast
-
-" Make sure that the buffer is modifiable
set modifiable
-
-" ... and empty
%d
-" Loop over all lines in the original text.
-
+" Go to first buffer
wincmd p
-" Use contextstartline and contextstopline if they are set.
-
+" If contextstartline and contextstartline are set, use them.
if exists("contextstartline")
- let s:lnum = contextstartline
- if !(s:lnum >= 1 && s:lnum <= line("$"))
- let s:lnum = 1
- endif
+ let s:lnum = max([1, min([line("$"), contextstartline]) ])
else
let s:lnum = 1
endif
if exists("contextstopline")
- let s:end = contextstopline
- if !(s:end >= s:lnum && s:end <= line("$"))
- let s:end = line("$")
- elseif s:end < 0
- let s:end = line("$") - s:end
+ if contextstopline <= 0
+ let contextstopline = line("$") + contextstopline
endif
+ let s:end = min([line("$"), max([s:lnum, contextstopline]) ])
else
let s:end = line("$")
endif
let s:buffer_lnum = 1
+" Loop over all lines in the original text.
while s:lnum <= s:end
" Get the current line
let s:line = getline(s:lnum)
let s:len = strlen(s:line)
- let s:new = "\\NL{}"
+ let s:new = ''
" Loop over each character in the line
let s:col = 1
@@ -73,15 +64,11 @@ while s:lnum <= s:end
" we don't need to print in in that case
if strlen(s:temp) > 0
" Change special TeX characters to escape sequences.
-" The funny \type{||||||||||} and \type{$$$$$$$$$} characters should never
-" appear in {\em normal} \TEX\ file. As a side||effect, this script can not
-" pretty print itself.
- let s:temp = substitute( s:temp, '\\', '\\letterbackslash||||||||||$$$$$$$$$$', 'g')
- let s:temp = substitute( s:temp, '{', '\\letteropenbrace||||||||||$$$$$$$$$$', 'g')
- let s:temp = substitute( s:temp, '}', '\\letterclosebrace||||||||||$$$$$$$$$$', 'g')
- let s:temp = substitute( s:temp, '||||||||||' , '{' , 'g')
- let s:temp = substitute( s:temp, '\$\$\$\$\$\$\$\$\$\$' , '}' , 'g')
- let s:new = s:new . '\SYN[' . s:id_name . ']{' . s:temp . '}'
+ let s:temp = escape( s:temp, '\{}')
+ if !empty(s:id_name)
+ let s:temp = '\SYN[' . s:id_name . ']{' . s:temp . '}'
+ endif
+ let s:new = s:new . s:temp
endif
" Why will we ever enter this loop
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
new file mode 100644
index 00000000000..ff24e81e4df
--- /dev/null
+++ b/Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex
@@ -0,0 +1,94 @@
+%D \module
+%D [ file=t-syntax-groups,
+%D version=2011.06.12,
+%D title=\CONTEXT\ User Module,
+%D subtitle=Syntax highlighting support,
+%D author=Aditya Mahajan,
+%D date=\currentdate,
+%D copyright=Aditya Mahajan,
+%D email=adityam <at> umich <dot> edu,
+%D license=Simplified BSD License]
+
+\writestatus{loading}{ConTeXt User Module / Syntax Highlighting Support}
+
+% 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]
+
+\unprotectmodulecatcodes
+
+\def\colorscheme::name {}
+
+\def\syntaxgroup::id {syntaxgroup}
+\def\syntaxgroup::namespace {@@@@\colorscheme::name\syntaxgroup::id}
+\def\syntaxgroup::name {}
+
+\installparameterhandler \syntaxgroup::namespace \syntaxgroup::id
+
+\def\definesyntaxgroup
+ {\dodoubleargument\syntaxgroup::define}
+
+\starttexdefinition syntaxgroup::define [#1][#2]
+ % #1 list name
+ % #2 options
+ \doifassignmentelse{#2}
+ {
+ \def\syntaxgroup::get_parameters##1%
+ {
+ \edef\syntaxgroup::name {##1}
+ \getparameters[\syntaxgroup::namespace##1]
+ [\c!color=,\c!style=,\c!command=,#2]
+ \doifsomething{\syntaxgroupparameter\c!color}
+ {
+ \expanded{\definecolor[\syntaxgroup::namespace-##1-color]
+ [\syntaxgroupparameter\c!color]}
+ \getparameters[\syntaxgroup::namespace##1][\c!color=\syntaxgroup::namespace-##1-color]
+ }
+ }
+ }{
+ \def\syntaxgroup::get_parameters##1%
+ {
+ \copyparameters[\syntaxgroup::namespace##1][\syntaxgroup::namespace#2]
+ [\c!color,\c!style,\c!command]
+ }
+ }
+
+ \processcommalist[#1]\syntaxgroup::get_parameters
+\stoptexdefinition
+
+\def\startcolorscheme%
+ {\dosingleargument\colorscheme::start}
+
+\starttexdefinition colorscheme::start [#1]
+ \pushmacro\colorscheme::name
+ \setcolorscheme{#1}
+ \getparameters[\syntaxgroup::namespace][\c!color=,\c!style=,\c!command=]
+\stoptexdefinition
+
+\def\stopcolorscheme
+ {\popmacro\colorscheme::name}
+
+\def\setcolorscheme#1%
+ {\edef\colorscheme::name{#1}}
+
+\starttexdefinition syntaxgroup [#1]#2
+ % #1 = style
+ % #2 = content
+ \begingroup
+ \edef\syntaxgroup::name{#1}%
+ \syntaxgroupparameter\c!command
+ {
+ \dostartattributes{\syntaxgroup::namespace #1}\c!style\c!color
+ #2
+ \dostopattributes
+ }
+ \endgroup
+\stoptexdefinition
+
+\def\currentsyntaxgroup {\syntaxgroup::name}
+
+\protectmodulecatcodes
+\stopmodule
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
new file mode 100644
index 00000000000..35f24c656d7
--- /dev/null
+++ b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.tex
@@ -0,0 +1,230 @@
+%D \module
+%D [ file=t-syntax-highlight,
+%D version=2011.06.14,
+%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> umich <dot> edu,
+%D license=Simplified BSD License]
+
+\writestatus{loading}{ConTeXt User Module / Code syntax highlighting}
+
+\startmodule [syntax-highlight]
+\usemodule [syntax-groups]
+\usemodule [filter]
+\usemodule [module-catcodes]
+
+\unprotectmodulecatcodes
+
+\startinterface all
+ \setinterfaceconstant {syntax} {syntax}
+\stopinterface
+
+%D Name space
+
+\def\syntaxhighlighting::id {syntaxhighlighting}
+\def\syntaxhighlighting::namespace {@@@@\syntaxhighlighting::id}
+\def\syntaxhighlighting::name {}
+
+\installparameterhandler \syntaxhighlighting::namespace \syntaxhighlighting::id
+\installsetuphandler \syntaxhighlighting::namespace \syntaxhighlighting::id
+
+\def\definesyntaxhighlighting
+ {\dodoubleargument\syntaxhighlighting::define}
+
+\starttexdefinition syntaxhighlighting::define [#1][#2]
+ \getparameters[\syntaxhighlighting::namespace#1][\s!parent=\syntaxhighlighting::namespace,#2]
+
+ \edef\syntaxhighlighting::name{#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
+
+ \edef\syntaxhighlighting::name{\currentexternalfilter}
+ \edef\colorscheme::name{\externalfilterparameter\c!alternative}
+
+ \let\SYN\syntaxgroup
+ \let\\\textbackslash
+ \let\{\textbraceleft
+ \let\}\textbraceright
+
+ \def\tab##1%
+ {\dorecurse{##1}{\space}}%
+
+ \doifmode\s!mkii{\setups{syntaxhighlighting::setup_line_number_mkii}}%
+
+ \doifinset{\externalfilterparameter\c!option}{\v!packed}
+ {\setupwhitespace[\v!none,\v!flexible]}%
+
+ \setcatcodetable\externalfilter::minimal_catcodes
+ \activatespacehandler{\syntaxhighlighting::namespace\externalfilterparameter\c!space}
+\stopsetups
+
+\startsetups syntaxhighlighting::setup_line_number_mkiv
+ \definelinenumbering [#1]
+
+ \setuplinenumbering
+ [\syntaxhighlighting::name]
+ [\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
+
+\doifmode\s!mkii
+ {\newcount\syntaxhighlighting::linenumber}
+
+\startsetups syntaxhighlighting::setup_line_number_mkii
+\doif{\externalfilterparameter\c!numbering}\v!yes
+ {% setuplinenumbering resets \linenumber. So we save the value of linenumber and
+ % revert it back.
+ \syntaxhighlighting::linenumber=\linenumber
+
+ \setuplinenumbering
+ [\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},
+ ]
+
+ \linenumber=\syntaxhighlighting::linenumber}
+\stopsetups
+
+\startmode [\s!mkiv]
+\starttexdefinition syntaxhighlighting::read_command #1
+ \doifelse{\externalfilterparameter\c!numbering}\v!yes
+ {\startlinenumbering
+ [\syntaxhighlighting::name]
+ [\c!continue=\externalfilterparameter{\c!number\c!continue}]
+ \ReadFile{#1}
+ \stoplinenumbering}
+ {\ReadFile{#1}}
+\stoptexdefinition
+\stopmode
+
+\startmode [\s!mkii]
+\starttexdefinition syntaxhighlighting::read_command #1
+ \doifelse{\externalfilterparameter\c!numbering}\v!yes
+ {\doifelse{\externalfilterparameter{\c!number\c!continue}}\v!yes
+ {\startlinenumbering[\v!continue]}
+ {\startlinenumbering}
+ \syntaxhighlighting::read_command_aux{#1}
+ \stoplinenumbering}
+ {\syntaxhighlighting::read_command_aux{#1}}
+\stoptexdefinition
+
+\starttexdefinition syntaxhighlighting::read_command_aux #1
+ % In the filter module, style=something does not work in MkII.
+ % So, we explicitly add the global style before reading the file.
+ %
+ \dostartattributes{\syntaxhighlighting::namespace}\c!style\c!color
+ \dostartattributes{\syntaxhighlighting::namespace\syntaxhighlighting::name}\c!style\c!color
+ \ReadFile{#1}
+ \dostopattributes
+ \dostopattributes
+\stoptexdefinition
+\stopmode
+
+
+\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}}
+
+\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 59daac5d5da..f2713a0af1b 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.03.06,
+%D version=2011.06.14,
%D title=\CONTEXT\ User Module,
%D subtitle=Vim syntax highlighting,
%D author=Aditya Mahajan,
@@ -11,34 +11,21 @@
\writestatus{loading}{ConTeXt User Module / Vim syntax highlighting}
-\startmodule[vim]
-\usemodule[filter]
+\startmodule [vim]
+\usemodule [filter]
+\usemodule [syntax-highlight]
+\usemodule [syntax-groups]
+\usemodule [module-catcodes]
-% I use the experimental namespaces defined in t-filter.
-\pushcatcodetable
-\setcatcodetable\externalfiltermodulecatcodes
-
-% Colors are specified in hex; in MkII the hex mode needs to be activated.
-\doifmode\s!mkii
- {\setupcolor[hex]}
-
-\startinterface all
- \setinterfaceconstant {syntax} {syntax}
-\stopinterface
+\unprotectmodulecatcodes
\def\vimtyping::id {vimtyping}
\def\vimtyping::namespace {@@@@\vimtyping::id}
\def\vimtyping::name {}
-\def\vimalternative::id {vimalternative}
-\def\vimalternative::namespace {@@@@\vimalternative::id}
-\def\vimalternative::name {}
-
\installparameterhandler \vimtyping::namespace \vimtyping::id
\installsetuphandler \vimtyping::namespace \vimtyping::id
-
-
\def\definevimtyping
{\dodoubleargument\vimtyping::define}
@@ -46,81 +33,11 @@
\getparameters[\vimtyping::namespace#1][\s!parent=\vimtyping::namespace,#2]
\edef\vimtyping::name{#1}
- \doifmode\s!mkiv{\setups{vimtyping::setup_line_number_mkiv}}
-
- \defineexternalfilter[#1][\s!parent=\vimtyping::namespace#1]
- \setvalue{type#1file}{\getvalue{process#1file}}
+ \definesyntaxhighlighting[#1][\s!parent=\vimtyping::namespace#1]
\stoptexdefinition
-\startsetups vimtyping::setup
-
- \edef\vimtyping::name{\currentexternalfilter}
- \edef\vimalternative::name{\externalfilterparameter\c!alternative}
-
- \let\SYN\vimsyntax
- \def\NL{\strut}%
-
- \def\tab##1%
- {\dorecurse{##1}{\space}}%
-
- \doifmode\s!mkii{\setups{vimtyping::setup_line_number_mkii}}%
-
- \doifinset{\externalfilterparameter\c!option}{\v!packed}
- {\setupwhitespace[\v!none,\v!flexible]}%
-
- \setcatcodetable\externalfilter::write_catcodes
-\stopsetups
-
-\startsetups vimtyping::setup_line_number_mkiv
- \definelinenumbering [#1]
-
- \setuplinenumbering
- [\vimtyping::name]
- [\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
-
-\doifmode\s!mkii
- {\newcount\vimtyping::linenumber}
-
-\startsetups vimtyping::setup_line_number_mkii
-\doif{\externalfilterparameter\c!numbering}\v!yes
- {% setuplinenumbering resets \linenumber. So we save the value of linenumber and
- % revert it back.
- \vimtyping::linenumber=\linenumber
-
- \setuplinenumbering
- [\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},
- ]
-
- \linenumber=\vimtyping::linenumber}
-\stopsetups
-
+% Mode to testing the dev version of 2context script.
\doifmodeelse{vimtest}
{\def\vimtyping::script_name{2context.vim}}
{\def\vimtyping::script_name{kpse:2context.vim}}
@@ -135,206 +52,178 @@
-c "syntax on" %
-c "set syntax=\externalfilterparameter\c!syntax" %
-c "let contextstartline=\externalfilterparameter\c!start" %
- -c "let contextstopline=\externalfilterparameter\c!stop" %
+ -c "let contextstopline=\externalfilterparameter\c!stop" %
-c "source \vimtyping::script_name" %
-c "qa" %
\externalfilterinputfile\space
\externalfilteroutputfile}
-\startmode [\s!mkiv]
-\starttexdefinition vimtyping::read_command #1
- \doifelse{\externalfilterparameter\c!numbering}\v!yes
- {\startlinenumbering
- [\vimtyping::name]
- [\c!continue=\externalfilterparameter{\c!number\c!continue}]
- \ReadFile{#1}
- \stoplinenumbering}
- {\ReadFile{#1}}
-\stoptexdefinition
-\stopmode
-
-\startmode [\s!mkii]
-\starttexdefinition vimtyping::read_command #1
- \doifelse{\externalfilterparameter\c!numbering}\v!yes
- {\doifelse{\externalfilterparameter{\c!number\c!continue}}\v!yes
- {\startlinenumbering[\v!continue]}
- {\startlinenumbering}
- \ReadFile{#1}
- \stoplinenumbering}
- {\ReadFile{#1}}
-\stoptexdefinition
-\stopmode
-
-\def\startvimalternative
- {\dosingleargument\vimalternative::start}
-
-\def\vimalternative::start[#1]%
- {\pushmacro\vimalternative::name
- \edef\vimalternative::name{#1}}
-
-\def\stopvimalternative
- {\popmacro\vimalternative::name}
-
-\def\setvimsyntax
- {\doquadrupleargument\vimalternative::set_syntax}
-
-\starttexdefinition vimalternative::set_syntax [#1][#2][#3][#4]
- % #1 = name
- % #2 = color
- % #3 = style
- % #4 = command
- \def\dodosetupvimsyntax##1%
- {\doifsomething{#2}
- % we check if color exists; otherwise ConTeXt gives a warning on stdout
- % which is very distracting
- {\definecolor[\vimalternative::namespace\vimalternative::name##1color_name] [#2]
- \getparameters[\vimalternative::namespace\vimalternative::name##1]
- [\c!color={\vimalternative::namespace\vimalternative::name##1color_name}]}
- \getparameters[\vimalternative::namespace\vimalternative::name##1]
- [\c!style=#3,
- \c!command=#4]}
- \processcommalist[#1]\dodosetupvimsyntax
-\stoptexdefinition
+\setupvimtyping
+ [% \c!tab=4,
+ % \c!start=1,
+ % \c!stop=0,
+ % \c!syntax=context,
+ % \c!alternative=pscolor,
+ % \c!before=,
+ % \c!after=,
+ % \c!style=\tttf,
+ % \c!color=,
+ \c!filtercommand=\vimtyping::filter_command,
+ % \c!continue=yes,
+ % \c!read=\v!yes,
+ % \c!readcommand=\syntaxhighlighting::read_command,
+ \c!output=\externalfilterbasefile.vimout,
+ % \c!setups=syntaxhighlighting::setup,
+ % \c!option=\v!packed, % Could be a list
+ \s!parent=\syntaxhighlighting::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\currentvimtyping {\vimtyping::name}
-\starttexdefinition vimsyntax [#1]#2
- % #1 = style
- % #2 = content
- \dostartattributes{\vimalternative::namespace\vimalternative::name Normal}\c!style\c!color\empty
- \dostartattributes{\vimalternative::namespace\vimalternative::name #1}\c!style\c!color\empty
- \getvalue{\vimalternative::namespace\vimalternative::name#1\c!command}{#2}
- \dostopattributes
- \dostopattributes
-\stoptexdefinition
+\startsetups[vim-minor-groups]
+ \definesyntaxgroup
+ [SpecialComment]
+ [Comment]
-% \startvimalternative[pscolor]
-%
-% \definesyntax
-% [Normal]
-% [color=\externalfilterparameter\c!color,
-% style=\tttf,
-% command=]
-%
-% \stopvimalternative
+ \definesyntaxgroup
+ [String,Character,Number,Boolean,Float]
+ [Constant]
-\startvimalternative[pscolor]
- \setvimsyntax [Normal] [\externalfilterparameter\c!color][\tttf]
+ \definesyntaxgroup
+ [Function]
+ [Identifier]
- \setvimsyntax
- [Constant,Character,Boolean,Float]
- [h=007068]
+ \definesyntaxgroup
+ [Condition,Repeat,Label,Operator,Keyword,Exception]
+ [Statement]
- \setvimsyntax [Number] [h=907000]
+ \definesyntaxgroup
+ [Include,Define,Macro,PreCondit]
+ [Preproc]
- \setvimsyntax
- [Identifier, Function]
- [h=a030a0]
+ \definesyntaxgroup
+ [StorateClass,Structure,Typedef]
+ [Type]
- \setvimsyntax
- [Statement,Conditional,Repeat,Label,Operator,Keyword,Exception]
- [h=2060a8]
+ \definesyntaxgroup
+ [SpecialChar,Delimiter,Debug]
+ [Special]
+\stopsetups
- \setvimsyntax
- [PreProc, Include, Define, Macro, PreCondit]
- [h=009030]
+\startcolorscheme[pscolor]
+ % Vim Preferred groups
+ \definesyntaxgroup
+ [Constant]
+ [\c!color={h=007068}]
- \setvimsyntax
- [Type,StorageClass, Structure, Typedef]
- [h=0850a0]
+ \definesyntaxgroup
+ [Identifier]
+ [\c!color={h=a030a0}]
- \setvimsyntax [Special] [h=907000]
- \setvimsyntax [SpecialKey][h=1050a0]
+ \definesyntaxgroup
+ [Statement]
+ [\c!color={h=2060a8}]
- \setvimsyntax
- [Tag, Delmiter]
+ \definesyntaxgroup
+ [PreProc]
+ [\c!color={h=009030}]
- \setvimsyntax
- [Comment, SpecialComment]
- [h=606000]
+ \definesyntaxgroup
+ [Type]
+ [\c!color={h=0850a0}]
- \setvimsyntax
- [Debug,Ignore]
+ \definesyntaxgroup
+ [Special]
+ [\c!color={h=907000}]
- \setvimsyntax [Todo] [h=e0e090]
- \setvimsyntax [Error] [h=c03000]
- \setvimsyntax [Underlined][h=6a5acd][][\underbar]
+ \definesyntaxgroup
+ [Comment]
+ [\c!color={h=606000}]
-\stopvimalternative
+ \definesyntaxgroup
+ [Ignore]
-%TODO
-% \setvimsyntax [id] [bg=, fc=, style=, command=] == \localframed[options]
-\startvimalternative[blackandwhite]
- \setvimsyntax [Normal] [\externalfilterparameter\c!color][\tttf]
+ \definesyntaxgroup
+ [Todo]
+ [\c!color={h=800000}]
- \setvimsyntax
- [Constant,Character,Boolean,Float,Number,Identifier,Function]
+ \definesyntaxgroup
+ [Error]
+ [\c!color={h=c03000}]
- \setvimsyntax
- [Statement,Conditional,Repeat,Label,Operator,Keyword,Exception]
- [][][\bold]
+ \definesyntaxgroup
+ [Underlined]
+ [\c!color={h=6a5acd},
+ \c!command=\underbar]
- \setvimsyntax
- [PreProc, Include, Define, Macro, PreCondit]
- [][][\bold]
+ \setups{vim-minor-groups}
- \setvimsyntax
- [Type,StorageClass, Structure, Typedef]
- [][][\bold]
+ \definesyntaxgroup
+ [Number]
+ [\c!color={h=907000}]
+\stopcolorscheme
- \setvimsyntax [Special, SpecialKey]
+\startcolorscheme[blackandwhite]
+ \definesyntaxgroup
+ [Constant]
- \setvimsyntax [Tag, Delmiter]
+ \definesyntaxgroup
+ [Identifier]
- \setvimsyntax
- [Comment, SpecialComment]
- [][][\italic]
+ \definesyntaxgroup
+ [Statement]
+ [\c!style=bold]
- \setvimsyntax
- [Debug,Ignore]
+ \definesyntaxgroup
+ [PreProc]
+ [\c!style=bold]
- \setvimsyntax [Todo] [][][\inframed]
- \setvimsyntax [Error] [][][\overstrike]
- \setvimsyntax [Underlined][][][\underbar]
+ \definesyntaxgroup
+ [Type]
+ [\c!style=bold]
-\stopvimalternative
+ \definesyntaxgroup
+ [Special]
-\setupvimtyping
- [\c!tab=4,
- \c!start=1,
- \c!stop=0,
- \c!syntax=context,
- \c!alternative=pscolor,
- \c!before=,
- \c!after=,
- \c!filtercommand=\vimtyping::filter_command,
- \c!continue=yes,
- \c!read=\v!yes,
- \c!readcommand=\vimtyping::read_command,
- \c!output=\externalfilterbasefile.vimout,
- \c!setups=vimtyping::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=\tfx,
- \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,
- ]
+ \definesyntaxgroup
+ [Comment]
+ [\c!style=italic]
-\def\currentvimtyping {\vimtyping::name}
+ \definesyntaxgroup
+ [Ignore]
+
+ \definesyntaxgroup
+ [Todo]
+ [\c!command=\inframed]
+
+ \definesyntaxgroup
+ [Error]
+ [\c!command=\overstrike]
+
+ \definesyntaxgroup
+ [Underlined]
+ [\c!command=\underbar]
+
+ \setups{vim-minor-groups}
-\popcatcodetable
+\stopcolorscheme
+\protectmodulecatcodes
\stopmodule