Loading ...
Sorry, an error occurred while loading the content.

37541Re: matchit support for python

Expand Messages
  • Benji Fisher
    Sep 3, 2004
    • 0 Attachment
      On Wed, Sep 01, 2004 at 12:03:01PM +0200, Bram Moolenaar wrote:
      > Edward Peschko wrote:
      > > > > wow.. that's cool.. any chance on getting that included with the
      > > > > standard distribution (and maybe making matchit.vim automatically
      > > > > call it instead if your filetype so happens to be equal to python?

      > > > ...
      > > > For the same reason the matchit plugin isn't enabled by default. It is
      > > > included in the distribution, thus it's just a matter of enabling it
      > > > when you want to.
      > >
      > > well, I don't mind having to do a source statement in order to get it
      > > running, but it would be cool to include it as part of the standard
      > > distribution so I don't need to download it separately.
      > The matchit plugin is included. It's probably not a bad idea if the
      > Python version would be merged into it. Would anybody want the matchit
      > functionality but not the extra Python stuff?
      > Otherwise we could include matchit_python.vim as well, and instruct
      > users to install that additionally. This is more complicated, thus it
      > would be good if we can avoid that.

      That would require a change to matchit.vim . Currently, the only
      customization for different file types is that matchit.vim looks for a
      list of regular expressions (usually defined in the ftplugin file) that
      define matching pairs. I suppose the simplest thing to do would be to
      look for a function like Matchit_python(); if the function exists and
      returns a non-zero value, then use it to decide where to jump;
      otherwise, continue as normal. The Matchit_python() function would be
      perhaps half as long as the current python_match.vim file, and would
      probably have to be defined in the ftplugin file.

      Another possibility is to add a new file to the distribution:
      $VIMRUNTIME/python_matchit.vim . Unlike the current python_matchit.vim,
      this would define only the Matchit_python() function, not actually remap
      % . The maintainer of the distribution would have to do this, not the
      maintainer of the standard ftplugin file. It might be a good thing to
      have an example in the standard distribution of a plugin with this sort
      of naming convention.

      The only other language I know where this might be useful is TeX.
      Matchit.vim can bounce between \begin{foo} and \end{foo}, but not
      between $ and $.

      HTH --Benji Fisher
    • Show all 11 messages in this topic