From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/70976 Path: news.gmane.org!not-for-mail From: Andreas Schneider Newsgroups: gmane.comp.tex.context Subject: Re: Custom parameters/options for t-vim Date: Wed, 31 Aug 2011 09:15:52 +0200 Message-ID: <4E5DDFA8.3070408@gmx.de> References: <4E5CF365.2040908@gmx.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1314775013 31601 80.91.229.12 (31 Aug 2011 07:16:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 31 Aug 2011 07:16:53 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Aug 31 09:16:48 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qyf2S-0001Z9-R7 for gctc-ntg-context-518@m.gmane.org; Wed, 31 Aug 2011 09:16:44 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B9EA2CAF36; Wed, 31 Aug 2011 09:16:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id GU6rAkX+Hq49; Wed, 31 Aug 2011 09:16:37 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 79CDACAF31; Wed, 31 Aug 2011 09:16:37 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 32482CAF31 for ; Wed, 31 Aug 2011 09:16:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qKqdRxiKwvW8 for ; Wed, 31 Aug 2011 09:16:34 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 1D48DCAF26 for ; Wed, 31 Aug 2011 09:16:34 +0200 (CEST) Original-Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with SMTP id p7V7GX4x006571 for ; Wed, 31 Aug 2011 09:16:33 +0200 Original-Received: (qmail invoked by alias); 31 Aug 2011 07:16:32 -0000 Original-Received: from p54B4AFA4.dip.t-dialin.net (EHLO [192.168.1.3]) [84.180.175.164] by mail.gmx.net (mp006) with SMTP; 31 Aug 2011 09:16:32 +0200 X-Authenticated: #2825193 X-Provags-ID: V01U2FsdGVkX19QgJow7yVQSPB4t/reZMFmn4RcPy9Sw6TYIvZPVt VSNUHZJBnwQkNv User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: X-Y-GMX-Trusted: 0 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.165.64.22; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0rFqTgxPy - d92afcf69ff6 - 20110831 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:70976 Archived-At: On 29.08.2011 23:35, Aditya Mahajan wrote: > On Tue, 30 Aug 2011, Andreas Schneider wrote: > >> I worked with t-vim a bit more and encountered a small problem with >> the way vim handles syntax definitions. Some of them have several >> modes that get activated by setting a variable first. For example the >> syntax "sh" (shell scripts) can be enhanced for bash, ksh, etc. >> >> Example: >> let g:is_bash=1 >> set syntax=sh >> >> Now a line like "export foo=bar" is highlighted differently than when >> I would omit the "let g:is_bash=1". >> >> Therefore I would propose another options to \setupvimtyping to >> specify custom options to be passed to vim. Preferably they should be >> passed at least before the "set syntax=..." line to make sure that >> this particular case -- i.e. switching syntax modes -- works well >> (which may be the only necessary case). > > That is certainly possible, but the exact solution depends on how robust > you want it to be. I can easily add an option so that > > \definevimtyping > [....] > [extras={let g:is_bash=1}] > > will pass the argument to vim. However, string arguments like > > \definevimtyping > [....] > [extras={let g:name="Whatever"}] > > will not work. The reason is that, t-vim first creates a command line > argument that is passed to mtxrun. mtxrun parses the entire expression, > including all the options, When mtxrun figures out that all the > arguments were meant for an external program, it recreates the list of > arguments (to the best of its abilities), and passes the arguments to > the shell. Then the shell tries to interpret the quotes. I haven't been > able to find a solution that will work correctly though these three > transformations. > > Another option is to write everything to an external file and source it > as a vimrc file. So, you could do: > > \definevimtyping > [...] > [vimrc=shell] > > \startvimrc[shell] > let g:is_bash = 1 > \stopvimrc > > This requires more coding, but is much more flexible than the first option. > > Do all syntax highlighting options work with 0/1 parameters? If so, then > the first alternative is easiest. As far as I can see, most of the relevant options (if not all) are 0/1 switches, so the first alternative should be enough. Thanks to the pipe syntax of vim's command mode, it might be even possible specify more parameters that way. [extras={let g:foo=bar | let g:shaz=bot}] -- at least vim accepts that usually, I guess it doesn't make a difference if specified as commandline parameter. However I also like the idea of the optional vimrc via buffer. I think it might be a nice-to-have feature for the ToDo list :-) Thank you for the analysis and for coming up with these possible implementations! -- Best Regards, Andreas ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________