diff options
author | Karl Berry <karl@freefriends.org> | 2011-02-07 00:17:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-02-07 00:17:28 +0000 |
commit | 6ed45e99f37edb7c8a4a7e03adf20f60b93b0319 (patch) | |
tree | 2a7b90b09d7128ff369dac17232ac52970f7ddcf /Master/texmf-dist/tex | |
parent | 9771992141589e82ce1d540e026726b59004f44e (diff) |
context-vim (7feb11)
git-svn-id: svn://tug.org/texlive/trunk@21319 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/context/third/vim/2context.vim | 25 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/vim/t-vim.tex | 73 |
2 files changed, 38 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/context/third/vim/2context.vim b/Master/texmf-dist/tex/context/third/vim/2context.vim index 7e2f32864a5..533a116983e 100644 --- a/Master/texmf-dist/tex/context/third/vim/2context.vim +++ b/Master/texmf-dist/tex/context/third/vim/2context.vim @@ -1,15 +1,12 @@ -" Author : Aditya Mahajan -" version : 0.2 +" Author : Aditya Mahajan <adityam [at] umich [dot] edu> +" version : 2011.02.05 +" license : Simplified BSD License -" This script converts the syntax highlighting of a file to ConTeXt. This file -" is based on 2html.vim. +" 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 output buffer, +" and the second buffer is the input buffer. -" Create a new buffer with .vimout extension -if expand("%") == "" - new texput.vimout -else - new %:r.vimout -endif +" We move back and forth between the buffers, " Make sure that the buffer is modifiable set modifiable @@ -17,8 +14,8 @@ set modifiable " ... and empty %d -" Go to previous buffer -wincmd p +" Go to the last buffer +sblast " Loop over all lines in the original text. " Use contextstartline and contextstopline if they are set. @@ -36,6 +33,8 @@ 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 endif else let s:end = line("$") @@ -114,3 +113,5 @@ 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-vim.tex b/Master/texmf-dist/tex/context/third/vim/t-vim.tex index e545a2089f7..81bad980536 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.01.29, +%D version=2011.02.05, %D title=\CONTEXT\ User Module, %D subtitle=Vim syntax highlighting, %D author=Aditya Mahajan, @@ -24,34 +24,19 @@ \setinterfaceconstant {syntax} {syntax} \stopinterface -\def\??vimtyping??{vimtyping} +\def\????vimtyping{@@@@vimtyping} -\def\vimtypingparameter #1{\csname\docheckparentparameter{\??vimtyping??\currentvimtyping}{#1}\endcsname} - -\def\setupvimtyping - {\dodoubleargument\dosetupvimtyping} - -\def\dosetupvimtyping[#1][#2]% - {\ifsecondargument - \getparameters[\??vimtyping??#1][#2]% - \else - \getparameters[\??vimtyping??][#1]% - \fi} - -\def\dotypevimfile[#1][#2][#3]% id options file - {\bgroup - \setupvimtyping[#1][#2]% - \getvalue{process#1file}[#3]% - \egroup} +\installparameterhandler \????vimtyping {vimtyping} +\installsetuphandler \????vimtyping {vimtyping} \def\definevimtyping {\dodoubleargument\dodefinevimtyping} \def\dodefinevimtyping[#1][#2]% - {\getparameters[\??vimtyping??#1][\s!parent=\??vimtyping??,#2]% + {\getparameters[\????vimtyping#1][\s!parent=\????vimtyping,#2]% \edef\currentvimtyping{#1}% - \defineexternalfilter[#1][\s!parent=\??vimtyping??#1]% - \setvalue{type#1file}{\dotripleargument\dotypevimfile[#1]} + \defineexternalfilter[#1][\s!parent=\????vimtyping#1]% + \setvalue{type#1file}{\dodoubleargument\doprocessexternalfilterfile[#1]}% } \startsetups[vimsetup] @@ -63,32 +48,25 @@ {\dorecurse{\vimtypingparameter\c!tab} {\space}} \doifinset{\vimtypingparameter\c!option}{\v!packed} - {\setupwhitespace[none]} - \setcatcodetable\vimcatcodes + {\setupwhitespace[\v!none,\v!flexible]} + \setcatcodetable\externalfilterwritecatcodes \stopsetups \def\vimfiltercommand {vim -u NONE % don't read global config file -e % run in ex mode + -s % silent -C % set compatible -n % no swap file -c "set tabstop=\vimtypingparameter\c!tab" % -c "syntax on" % -c "set syntax=\vimtypingparameter\c!syntax" % - -c "let contextstartline=\vimtypingparameter\c!start" % - -c "let contextstopline=\vimtypingparameter\c!stop" % - -c "source kpse:2context.vim" - -c "wqa"} - -\newcatcodetable \vimcatcodes -\startcatcodetable \vimcatcodes - \catcode`\\ = \escapecatcode - \catcode`\{ = \begingroupcatcode - \catcode`\} = \endgroupcatcode - \catcode`\^^M = \activecatcode - \catcode`\^^L = \activecatcode - \catcode`\ = \activecatcode -\stopcatcodetable + -c "let contextstartline=\externalfilterparameter\c!start" % + -c "let contextstopline=\externalfilterparameter\c!stop" % + -c "source 2context.vim" % + -c "qa" % + \externalfilteroutputfile\space + \externalfilterinputfile} \def\startvimalternative {\dosingleargument\dostartvimalternative} @@ -106,19 +84,19 @@ \def\dosetvimsyntax[#1][#2][#3][#4]% name color style command {\def\dodosetupvimsyntax##1% { \doifsomething{#2} - {\definecolor[\??vimtyping??:\currentvimalternative:##1:color] [#2]% - \getparameters[\??vimtyping??::\currentvimalternative::##1] - [\c!color={\??vimtyping??:\currentvimalternative:##1:color}]} - \getparameters[\??vimtyping??::\currentvimalternative::##1] + {\definecolor[\????vimtyping:\currentvimalternative:##1:color] [#2]% + \getparameters[\????vimtyping::\currentvimalternative::##1] + [\c!color={\????vimtyping:\currentvimalternative:##1:color}]} + \getparameters[\????vimtyping::\currentvimalternative::##1] [\c!style=#3, \c!command=#4]}% \processcommalist[#1]\dodosetupvimsyntax} \def\vimsyntax[#1]#2% style content - {\dostartattributes{\??vimtyping??::\currentvimalternative::Normal}\c!style\c!color\empty% - \dostartattributes{\??vimtyping??::\currentvimalternative::#1}\c!style\c!color\empty% - \getvalue{\??vimtyping??::\currentvimalternative::#1\c!command}{#2}% + {\dostartattributes{\????vimtyping::\currentvimalternative::Normal}\c!style\c!color\empty% + \dostartattributes{\????vimtyping::\currentvimalternative::#1}\c!style\c!color\empty% + \getvalue{\????vimtyping::\currentvimalternative::#1\c!command}{#2}% \dostopattributes \dostopattributes} @@ -192,7 +170,7 @@ \setvimsyntax [Comment, SpecialComment] - [][][\slanted] + [][][\italic] \setvimsyntax [Debug,Ignore] @@ -211,8 +189,7 @@ \c!alternative=pscolor, \c!before=, \c!after=, - \c!filter=\vimfiltercommand, - \c!filtercommand={\externalfilterparameter\c!filter\space \externalfilterinputfile}, + \c!filtercommand=\vimfiltercommand, \c!continue=yes, \c!read=\v!yes, \c!readcommand=\ReadFile, |