Toggle between if/endif in Vim with %

jmcnamara on 2009-09-04T11:15:58

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.

John.
--


What language?

Mr. Muskrat on 2009-09-04T11:31:13

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 %.

Re:What language?

jmcnamara on 2009-09-04T13:31:24

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.

Re:What language?

Mr. Muskrat on 2009-09-05T15:23:05

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.