Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jmcnamara (659)

  (email not shown publicly)

'ere I am, J.M.! The ghost in the machine:

perl -MCPAN -e 'install jmcnamara & _ x ord $ ;' | tail -1

Journal of jmcnamara (659)

Friday September 04, 2009
06:15 AM

Toggle between if/endif in Vim with %

[ #39580 ]
Dera Lazyweb,

In vi/vim is it possible to match if/endif in a non-standard language so you can toggle between them using %? I know that this feature is usually reserved for parentheses and braces but this particular language doesn't use them.

I can see, from reading around, that you can set regions via ":syntax region" but I'm not sure if that applies to this case.

I am not a vi user. I'm asking mainly for a colleague.


The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • There are a multitude of Vi[m] plugins that are written for specific languages. The matchit plugin works with Ada, ASP with VBS, Csh, DTD, Essbase, Fortran, HTML, JSP, LaTeX, Lua, Pascal, SGML, Shell, Tcsh, Vim, and XML. I use another plugin for SQL with it so that I can jump between IF and END IF, LOOP/END LOOP, etc using %.
    • The language is an in-house language with a syntax that is a little like Pascal.

      Thanks, for the tip about matchit. That looks interesting.

      • You're welcome. Yes, it is very interesting. It also looks like it would be fairly easy to modify an existing rule set or create a new one.