diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-13 01:16:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-13 01:16:24 +0000 |
commit | 86977875bd92696fb5822fedcf7ab75494fb40a5 (patch) | |
tree | 92ba24296862b65b46007deaefe398a084b391b5 /Master | |
parent | efd43becf184f97c6fc7e1193066d04240315e8e (diff) |
context-vim (12feb12)
git-svn-id: svn://tug.org/texlive/trunk@25382 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
4 files changed, 65 insertions, 35 deletions
diff --git a/Master/texmf-dist/doc/context/third/vim/vim.txt b/Master/texmf-dist/doc/context/third/vim/vim.txt index 8bdf5ea0afb..962495811ec 100644 --- a/Master/texmf-dist/doc/context/third/vim/vim.txt +++ b/Master/texmf-dist/doc/context/third/vim/vim.txt @@ -478,6 +478,30 @@ To disable loading of vimrc file, use The default is not to use any vimrc file. +A vimrc file gets loaded before syntax highlighting is enabled. If you want to +override the default syntax highlighting scheme, add the appropriate `syn ...` +commands to a vimrc file, and source that usign + + \definevimtyping + [...] + [... + extras=<name of vimrc file>, + ...] + +For example, suppose you are using a C++ library that defines `uDouble` as a +keyword, so you want to highlight it in your code. Use + + \startvimrc[name=cpp_extras] + syn keyword Type uDouble + \stopvimrc + + \definevimtyping + [cpp] + [ + syntax=cpp, + extras=cpp_extras, + ] + Messages and Tracing -------------------- diff --git a/Master/texmf-dist/tex/context/third/vim/2context.vim b/Master/texmf-dist/tex/context/third/vim/2context.vim index dfdaa8439c4..67c7bafdc6a 100644 --- a/Master/texmf-dist/tex/context/third/vim/2context.vim +++ b/Master/texmf-dist/tex/context/third/vim/2context.vim @@ -65,6 +65,8 @@ else let s:strip = 0 endif +let s:lines = [] + " Loop over all lines in the original text. let s:buffer_lnum = 1 let s:lnum = s:lstart @@ -133,18 +135,16 @@ while s:lnum <= s:lstop 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 + call add(s:lines, s:new) " Increment line numbers let s:lnum = s:lnum + 1 let s:buffer_lnum = s:buffer_lnum + 1 endwhile +" Go to previous buffer wincmd p -" We have a spurious line in the end. So we remove it. -$delete -" Write the file +echo s:lines +call setline(1,s:lines) +unlet s:lines write 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 add00c0526b..228bb390fd9 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 @@ -17,19 +17,6 @@ \unprotectmodulecatcodes -%% Temporary bugfix - -\startmode[\s!mkii] -\def\p!doifinsetelse#1#2#3#4% - {\donefalse - \edef\!!stringa{#3}% - \ifx\!!stringa\empty - \else - \processcommacommand[#4]\p!docheckiteminset - \fi - \ifdone\expandafter#1\else\expandafter#2\fi} -\stopmode - \startinterface all \setinterfaceconstant {syntax} {syntax} \setinterfaceconstant {highlight} {highlight} 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 522100bd78d..de904f25e1b 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.28, +%D version=2012.02.11, %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.28)} +\writestatus{loading}{Vim syntax highlighting (ver: 2012.02.11)} \startmodule [vim] \usemodule [filter] % loads module catcodes @@ -106,27 +106,30 @@ \doifmodeelse{vim-dev} {\def\vimtyping@script_name{2context.vim}} {\doifmodeelse\s!mkiv - {\ctxlua{context.setvalue("vimtyping@script_name",resolvers.resolve("full:2context.vim"))} - \ctxlua{print(resolvers.resolve("full:2context.vim")}} + {\ctxlua{context.setvalue("vimtyping@script_name",resolvers.resolve("full:2context.vim"))}} {\def\vimtyping@script_name{kpse:2context.vim}}} -\show\vimtyping@script_name - \def\vimtyping@filter_command - {vim -u \vimrcfilename\space % read global config file + {vim -u \vimrc_filename\space % read global config file + % --startuptime log + % -V3log + -X % dont connect to X server + -i NONE % dont use viminfo file --noplugin % dont load plugins -e % run in ex mode -s % silent -C % set compatible -n % no swap file - -c "set tabstop=\externalfilterparameter\c!tab" % - -c "syntax on" % + -c "syntax manual" % don't load filetype detection -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 "set tabstop=\externalfilterparameter\c!tab" % + % vim only accepts 10 -c commands, so we combine a few let statements + -c "let contextstartline=\externalfilterparameter\c!start | % + let contextstopline=\externalfilterparameter\c!stop | % + 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]" % + \vimrc_extras\space -c "source \vimtyping@script_name" % -c "qa" % \externalfilterinputfile\space @@ -195,13 +198,15 @@ [\vimrc@id] [\c!continue=\v!no, \c!read=\v!no, + \c!purge=\v!no, \c!filtercommand=\empty] -\def\vimrcfilename{NONE} +\def\vimrcfile_name{NONE} +\def\vimrc_extras{} \startsetups vimrc@setup \doifelsenothing{\externalfilterparameter\c!vimrc} - {\def\vimrcfilename{NONE}} + {\def\vimrc_filename{NONE}} {\begingroup \expanded{\setupexternalfilter[\vimrc@id][\c!name=\externalfilterparameter\c!vimrc]} @@ -210,7 +215,21 @@ \externalfilter@set_filenames - \global\xdef\vimrcfilename{\externalfilter@input_file} + \global\xdef\vimrc_filename{\externalfilter@input_file} + \endgroup + } + + \doifelsenothing{\externalfilterparameter\c!extras} + {\def\vimrc_extras{}} + {\begingroup + \expanded{\setupexternalfilter[\vimrc@id][\c!name=\externalfilterparameter\c!extras]} + + \edef\externalfilter@name{\vimrc@id} + \edef\currentexternalfilter{\vimrc@id} + + \externalfilter@set_filenames + + \global\xdef\vimrc_extras{-c "source \externalfilter@input_file"} \endgroup } \stopsetups |