summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/context/third/vim/vim.txt21
-rw-r--r--Master/texmf-dist/tex/context/third/vim/2context.vim150
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-groups.tex16
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkii32
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkiv24
-rw-r--r--Master/texmf-dist/tex/context/third/vim/t-vim.tex115
6 files changed, 120 insertions, 238 deletions
diff --git a/Master/texmf-dist/doc/context/third/vim/vim.txt b/Master/texmf-dist/doc/context/third/vim/vim.txt
index 2153621d943..8bdf5ea0afb 100644
--- a/Master/texmf-dist/doc/context/third/vim/vim.txt
+++ b/Master/texmf-dist/doc/context/third/vim/vim.txt
@@ -388,10 +388,23 @@ highlight color use
where `<color>` is any valid ConTeXt color.
-**Note**: Currently, if you use `highlight` with `numbering=on`, each
-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.
+When you pass a comma list to `highlight`, the `2context.vim` script
+wraps **each** of those line around `\HGL{....}` macro. The `\HGL` is, in turn, set to the
+value of `highlightcommand` key. So, if you want to change the way highlighting
+works, change the `highlightcommand`:
+
+ \definevimtyping
+ [...]
+ [...
+ highlightcommand=<command>,
+ ...]
+
+where `<command>` is any valid ConTeXt command. The default value is
+`highlightcommand` is `\syntaxhighlightline`; in MkIV, `\syntaxhighlightline` is
+defined as a bar; in MkII, `\syntaxhighlightline` is defined as a text
+background. The bar mechanism is more efficient but both mechanisms behave
+differently. The text background starts from the left edge of the line, while
+the bar starts from the first non-blank character.
Using TeX code in Comments
--------------------------
diff --git a/Master/texmf-dist/tex/context/third/vim/2context.vim b/Master/texmf-dist/tex/context/third/vim/2context.vim
deleted file mode 100644
index dfdaa8439c4..00000000000
--- a/Master/texmf-dist/tex/context/third/vim/2context.vim
+++ /dev/null
@@ -1,150 +0,0 @@
-" Author : Aditya Mahajan <adityam [at] umich [dot] edu>
-" version : 2011.12.23
-" license : Simplified BSD License
-
-" This script is part of the t-vim module for ConTeXt. It is based on 2html.vim.
-" 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.
-
-" Split screen and go to the second buffer, ensure modifiable is set, and the
-" buffer is empty.
-sblast
-set modifiable
-%d
-
-" Go to first buffer
-wincmd p
-
-" If contextstartline and contextstartline are set, use them.
-if exists("contextstartline")
- let s:lstart = max([1, min([line("$"), contextstartline]) ])
-else
- let s:lstart = 1
-endif
-
-if exists("contextstopline")
- if contextstopline <= 0
- let contextstopline = line("$") + contextstopline
- endif
- let s:lstop = min([line("$"), max([s:lstart, contextstopline]) ])
-else
- let s:lstop = line("$")
-endif
-
-" Set highlight
-if !exists("highlight")
- let highlight=[]
-endif
-
-" Set escapecomments
-if !exists("escapecomments")
- let escapecomments=0
-endif
-
-let s:strip = strlen( matchstr( getline(s:lstart), '^\s*' ) )
-
-" Find the smallest leading white space
-if exists("strip") && strip && (s:strip != 0)
- echo "Calculating amount of leading whitespace"
- for s:lnum in range(s:lstart, s:lstop)
- let s:line = getline(s:lnum)
- if (match(s:line, '^\s*$')) == -1 " line is not empty
- let s:space = matchstr(s:line, '^\s*')
- let s:len = strlen(s:space)
- " echo s:len
- let s:strip = min([s:strip, s:len])
- if s:strip == 0
- break
- end
- end
- endfor
- " echo "Strip amount:" . s:strip
-else
- let s:strip = 0
-endif
-
-" Loop over all lines in the original text.
-let s:buffer_lnum = 1
-let s:lnum = s:lstart
-
-while s:lnum <= s:lstop
-" Get the current line
- let s:line = getline(s:lnum)
- let s:len = strlen(s:line)
- let s:new = ''
-
-" Loop over each character in the line
- let s:col = s:strip + 1
- while s:col <= s:len
- let s:startcol = s:col " The start column for processing text
- let s:id = synID (s:lnum, s:col, 1)
- let s:col = s:col + 1
-" Speed loop (it's small - that's the trick)
-" Go along till we find a change in synID
- while s:col <= s:len && s:id == synID(s:lnum, s:col, 1)
- let s:col = s:col + 1
- endwhile
-
-" Output the text with the same synID, with class set to {s:id_name}
- let s:id = synIDtrans (s:id)
- let s:id_name = synIDattr (s:id, "name", "gui")
- let s:temp = strpart(s:line, s:startcol - 1, s:col - s:startcol)
-" Remove line endings (on unix machines reading windows files)
- let s:temp = substitute(s:temp, '\r*$', '', '')
-" It might have happened that that one has been the last item in a row, so
-" we don't need to print in in that case
- if strlen(s:temp) > 0
-" Change special TeX characters to escape sequences.
- 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
- let s:new = s:new . s:temp
- endif
-
-" Why will we ever enter this loop
-" if s:col > s:len
-" break
-" endif
- endwhile
-
-" Expand tabs
- let s:pad = 0
- let s:start = 0
- let s:idx = stridx(s:line, "\t")
- while s:idx >= 0
- let s:i = &ts - ((s:start + s:pad + s:idx) % &ts)
-" let s:new = substitute(s:new, '\t', strpart(s:expandedtab, 0, s:i), '')
- let s:new = substitute(s:new, '\t', '\\tab{' . s:i . '}', '')
- let s:pad = s:pad + s:i - 1
- let s:start = s:start + s:idx + 1
- let s:idx = stridx(strpart(s:line, s:start), "\t")
- endwhile
-
-" Remove leading whitespace
-" let s:new = substitute(s:new, '^\s\{' . s:strip . '\}', "", "")
-
-" Highlight line, if needed.
- if (index(highlight, s:lnum) != -1)
- let s:new = '\HGL{' . s:new . '}'
- endif
-
-" Go back and paste the current line
- wincmd p
- call append (s:buffer_lnum-1, s:new)
- wincmd p
-
-" Increment line numbers
- let s:lnum = s:lnum + 1
- let s:buffer_lnum = s:buffer_lnum + 1
-endwhile
-
-wincmd p
-" We have a spurious line in the end. So we remove it.
-$delete
-" Write the file
-write
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 5efe1719ac4..fa608595543 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.12.17,
+%D version=2012.01.03,
%D title=\CONTEXT\ User Module,
%D subtitle=Syntax highlighting support,
%D author=Aditya Mahajan,
@@ -9,17 +9,18 @@
%D email=adityam <at> ieee <dot> org,
%D license=Simplified BSD License]
-\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]}
+\writestatus{loading}{Syntax highlighting groups (ver: 2012.01.03)}
\startmodule [syntax-group]
\usemodule [module-catcodes]
-
+
\unprotectmodulecatcodes
+% Colors are specified in hex; in MkII the hex mode needs to be activated.
+\doifmode\s!mkii
+ {\setupcolor[hex]}
+
+
\def\colorscheme@name {}
\def\syntaxgroup@id {syntaxgroup}
@@ -28,6 +29,7 @@
\edef\t!syntaxgroup {\syntaxgroup@id}
+
\installparameterhandler \syntaxgroup@namespace \syntaxgroup@id
\installsetuphandler \syntaxgroup@namespace \syntaxgroup@id
\doifmode{\s!mkiv}
diff --git a/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkii b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkii
index 3119b2c6a00..add00c0526b 100644
--- a/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkii
+++ 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.12.17,
+%D version=2011.12.28,
%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: 2011.12.17)}
+\writestatus{loading}{Code syntax highlighting (ver: 2011.12.28)}
\startmodule [syntax-highlight]
\usemodule [syntax-groups]
@@ -31,9 +31,9 @@
\stopmode
\startinterface all
- \setinterfaceconstant {syntax} {syntax}
- \setinterfaceconstant {highlight} {highlight}
- \setinterfaceconstant {highlightcolor} {highlightcolor}
+ \setinterfaceconstant {syntax} {syntax}
+ \setinterfaceconstant {highlight} {highlight}
+ \setinterfaceconstant {highlightcolor} {highlightcolor}
\stopinterface
%D Name space
@@ -70,21 +70,21 @@
\edef\syntaxhighlighting@name{\currentexternalfilter}
\edef\colorscheme@name{\externalfilterparameter\c!alternative}
-
+
\let\SYN\syntaxgroup
- \let\HGL\syntaxhighlightline
+ \edef\HGL{\externalfilterparameter{\c!highlight\c!command}}
\let\\\textbackslash
\let\{\textbraceleft
\let\}\textbraceright
\def\tab##1%
{\dorecurse{##1}{\obeyedspace}}%
-
+
\doifmode\s!mkii{\setups{syntaxhighlighting@setup_line_number_mkii}}%
-
+
\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}
@@ -209,9 +209,13 @@
\c!number\c!width=2em,
\c!number\c!left=,
\c!number\c!right=,
- \c!number\c!command=,
+ \c!numbercommand=,
\c!number\c!distance=0.5em,
\c!number\c!align=\v!flushright,
+ %Highlight options
+ \c!highlight=,
+ \c!highlightcolor=lightgray,
+ \c!highlight\c!command=\syntaxhighlightline,
]
\def\currentsyntaxhighlighting {\syntaxhighlighting@name}
@@ -250,12 +254,14 @@
% Line highlighting
-\definetextbackground[syntaxhighlightline]
- [\c!location=\v!paragraph,
+\definetextbackground[syntaxhighlightline]
+ [\c!location=\v!text,
+ %% location=paragraph causes a spurious line break
\c!alternative=0,
\c!frame=\v!off,
\c!background=\v!color,
\c!backgroundcolor=\externalfilterparameter\c!highlightcolor,
+ \c!before=,
\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
index 19b6b0644c3..2ec5a5f5aaf 100644
--- a/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkiv
+++ b/Master/texmf-dist/tex/context/third/vim/t-syntax-highlight.mkiv
@@ -1,6 +1,6 @@
%D \module
%D [ file=t-syntax-highlight,
-%D version=2011.12.17,
+%D version=2011.12.28,
%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: 2011.12.17)}
+\writestatus{loading}{Code syntax highlighting (ver: 2011.12.28)}
\startmodule [syntax-highlight]
\usemodule [syntax-groups]
@@ -18,9 +18,9 @@
\unprotectmodulecatcodes
\startinterface all
- \setinterfaceconstant {syntax} {syntax}
- \setinterfaceconstant {highlight} {highlight}
- \setinterfaceconstant {highlightcolor} {highlightcolor}
+ \setinterfaceconstant {syntax} {syntax}
+ \setinterfaceconstant {highlight} {highlight}
+ \setinterfaceconstant {highlightcolor} {highlightcolor}
\stopinterface
%D Name space
@@ -57,9 +57,9 @@
\edef\syntaxhighlighting@name{\currentexternalfilter}
\edef\colorscheme@name{\externalfilterparameter\c!alternative}
-
+
\let\SYN\syntaxgroup
- \let\HGL\syntaxhighlightline
+ \edef\HGL{\externalfilterparameter{\c!highlight\c!command}}
\let\\\textbackslash
\let\{\textbraceleft
\let\}\textbraceright
@@ -68,10 +68,10 @@
\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}
@@ -152,9 +152,13 @@
\c!number\c!width=2em,
\c!number\c!left=,
\c!number\c!right=,
- \c!number\c!command=,
+ \c!numbercommand=,
\c!number\c!distance=0.5em,
\c!number\c!align=\v!flushright,
+ %Highlight options
+ \c!highlight=,
+ \c!highlightcolor=lightgray,
+ \c!highlight\c!command=\syntaxhighlightline,
]
\def\currentsyntaxhighlighting {\syntaxhighlighting@name}
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 2cfbb20f791..91fe748917c 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.18,
+%D version=2011.12.28,
%D title=\CONTEXT\ User Module,
%D subtitle=Vim syntax highlighting,
%D author=Aditya Mahajan,
@@ -9,7 +9,7 @@
%D email=adityam <at> ieee <dot> org,
%D license=Simplified BSD License]
-\writestatus{loading}{Vim syntax highlighting (ver: 2011.12.18)}
+\writestatus{loading}{Vim syntax highlighting (ver: 2011.12.28)}
\startmodule [vim]
\usemodule [filter] % loads module catcodes
@@ -36,8 +36,6 @@
\starttexdefinition vimtyping@define [#1][#2]
\setupvimtyping[#1][\s!parent=\vimtyping@namespace,#2]
- \edef\vimtyping@name{#1}
-
\definesyntaxhighlighting[#1][\s!parent=\vimtyping@namespace#1]
\setvalue{\e!start raw#1}{\bgroup\obeylines\dodoubleargument\vimtyping@start_raw[#1]}
@@ -48,9 +46,10 @@
\starttexdefinition vimtyping@start_raw [#1][#2]
% #1 = filter
% #2 = options
- \egroup %\bgroup in \start#1
+ \egroup %\bgroup in \start#1
\edef\vimtyping@name{#1}
+ \edef\externalfilter@name{#1}
\begingroup % to keep assignments local
\setupvimtyping[#1][\c!name=,#2]
@@ -64,7 +63,13 @@
\stoptexdefinition
\starttexdefinition vimtyping@stop_raw
+ % The last argument of the environment is \type{^M},
+ % so we explicitly backup one line.
+ \nobreak
+ \vskip-\dimexpr\lineheight+\parskip\relax
+ \nobreak
+ \removeunwantedspaces
\syntaxhighlighting@linenumbering_stop
\externalfilter@attributes_stop
\externalfilterparameter\c!after
@@ -75,8 +80,9 @@
\starttexdefinition vimtyping@inline_raw [#1][#2]
% #1 = filter
% #2 = options
-
+
\edef\vimtyping@name{#1}
+ \edef\externalfilter@name{#1}
\begingroup % to keep assignments local
\setupvimtyping[#1][\c!name=,\c!before=,\c!after=,#2]
@@ -135,6 +141,7 @@
\setvalue{\vimtyping@id-\c!escape-\v!no}{0}
\setvalue{\vimtyping@id-\c!escape-\v!yes}{1}
+
\setupvimtyping
[% \c!tab=4,
% \c!start=1,
@@ -145,10 +152,10 @@
% \c!after=,
% \c!style=\tttf,
% \c!color=,
- \c!strip=\v!off,
+ \c!strip=\v!off,
\c!escape=\v!off,
- \c!highlight=,
- \c!highlightcolor=lightgray,
+ % \c!highlight=,
+ % \c!highlightcolor=lightgray,
\c!filtercommand=\vimtyping@filter_command,
% \c!continue=yes,
% \c!read=\v!yes,
@@ -195,7 +202,7 @@
\edef\externalfilter@name{\vimrc@id}
\externalfilter@set_filenames
-
+
\global\xdef\vimrcfilename{\externalfilter@input_file}
\endgroup
}
@@ -244,31 +251,31 @@
\startcolorscheme[pscolor]
% Vim Preferred groups
- \definesyntaxgroup
- [Constant]
+ \definesyntaxgroup
+ [Constant]
[\c!color={h=007068}]
\definesyntaxgroup
[Identifier]
[\c!color={h=a030a0}]
- \definesyntaxgroup
- [Statement]
+ \definesyntaxgroup
+ [Statement]
[\c!color={h=2060a8}]
- \definesyntaxgroup
- [PreProc]
+ \definesyntaxgroup
+ [PreProc]
[\c!color={h=009030}]
- \definesyntaxgroup
- [Type]
+ \definesyntaxgroup
+ [Type]
[\c!color={h=0850a0}]
- \definesyntaxgroup
- [Special]
+ \definesyntaxgroup
+ [Special]
[\c!color={h=907000}]
- \definesyntaxgroup
+ \definesyntaxgroup
[Comment]
[\c!color={h=606000}]
@@ -281,11 +288,11 @@
\c!command=\vimtodoframed]
- \definesyntaxgroup
- [Error]
+ \definesyntaxgroup
+ [Error]
[\c!color={h=c03000}]
- \definesyntaxgroup
+ \definesyntaxgroup
[Underlined]
[\c!color={h=6a5acd},
\c!command=\underbar]
@@ -303,43 +310,43 @@
\stopcolorscheme
\startcolorscheme[blackandwhite]
- \definesyntaxgroup
- [Constant]
+ \definesyntaxgroup
+ [Constant]
\definesyntaxgroup
[Identifier]
- \definesyntaxgroup
- [Statement]
+ \definesyntaxgroup
+ [Statement]
[\c!style=bold]
- \definesyntaxgroup
- [PreProc]
+ \definesyntaxgroup
+ [PreProc]
[\c!style=bold]
- \definesyntaxgroup
- [Type]
+ \definesyntaxgroup
+ [Type]
[\c!style=bold]
- \definesyntaxgroup
- [Special]
+ \definesyntaxgroup
+ [Special]
- \definesyntaxgroup
+ \definesyntaxgroup
[Comment]
[\c!style=italic]
\definesyntaxgroup
[Ignore]
- \definesyntaxgroup
- [Todo]
+ \definesyntaxgroup
+ [Todo]
[\c!command=\inframed]
- \definesyntaxgroup
- [Error]
+ \definesyntaxgroup
+ [Error]
[\c!command=\overstrike]
- \definesyntaxgroup
+ \definesyntaxgroup
[Underlined]
[\c!command=\underbar]
@@ -362,25 +369,25 @@
% . fu dsFunction
% . re dsRegionMarker
% . er dsError
- \definesyntaxgroup
- [kw]
+ \definesyntaxgroup
+ [kw]
[\c!color={h=007020}, \c!style=bold]
- \definesyntaxgroup
- [dt]
- [\c!color={h=902000}]
+ \definesyntaxgroup
+ [dt]
+ [\c!color={h=902000}]
- \definesyntaxgroup
- [dv, bn, fl]
- [\c!color={h=40a070}]
+ \definesyntaxgroup
+ [dv, bn, fl]
+ [\c!color={h=40a070}]
- \definesyntaxgroup
- [ch, st]
- [\c!color={h=4070a0}]
+ \definesyntaxgroup
+ [ch, st]
+ [\c!color={h=4070a0}]
- \definesyntaxgroup
- [co]
- [\c!color={h=60a0b0}, \c!style=italic]
+ \definesyntaxgroup
+ [co]
+ [\c!color={h=60a0b0}, \c!style=italic]
\definesyntaxgroup
[ot]