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

Re: Possible problem with vat going backwards

Expand Messages
  • Tony Mechelynck
    ... From: Bram Moolenaar To: Tony Mechelynck Cc: Nicolas Schodet ; Vim-Dev
    Message 1 of 9 , Jul 22, 2005
      ----- Original Message -----
      From: "Bram Moolenaar" <Bram@...>
      To: "Tony Mechelynck" <antoine.mechelynck@...>
      Cc: "Nicolas Schodet" <nico@...>; "Vim-Dev" <vim-dev@...>
      Sent: Friday, July 22, 2005 1:26 PM
      Subject: Re: Possible problem with vat going backwards

      > Tony Mechelynck wrote:
      >> [...]
      >> > Even though it's now implemented in C this can still be slow.
      >> > Mainly when editing HTML, at every <BR> it tries to find the
      >> > matching </BR>, fails and continues looking backwards for the next
      >> > tag. Doing this in Vim script would be slower.
      >> Then maybe it would still be useful to have a user-settable list of
      >> unpaired tags -- either a buffer-local option, or reuse the
      >> b:unaryTagsStack variable already used for that purpose by the
      >> closetag.vim plugin (vim-online tip #13).
      > The list would need to be set by the ftplugin, since it's different for
      > each filetype. It could be a list of tags that are always alone, such
      > as <br>, so that the search for the matching one can be skipped.
      > We could use a regexp pattern for this to keep it simple.

      It can even differ for each programming style, since it can be empty for
      XHTML where every unpaired opening tag must end in />; and even in
      "classical" HTML, p,li,td etc. could be present or not depending on whether
      or not </p> </li> </td> etc. are systematically used in the file considered.
      The Closetag plugin uses a space-separated list (not as a List but as a
      String since it works with Vim 6) but if you think a regexp pattern would
      make it simpler (and faster), why not? -- OTOH, a space-separated list would
      make communication easier between this new feature and that existing (and, I
      think, widely used) add-on script. The script already has different defaults
      for HTML ("Area Base Br DD DT HR Img Input LI Link Meta P Param") and XML
      (the empty string). I use XHTML-like coding style except in one directory
      tree containing older files where <BR> tags are written <BR> not <BR />, so
      I already use the following lines in ~/vimfiles/ftplugin/html.vim:

      " Auto-close HTML tags (XHTML style) with Ctrl-_
      if expand("%:p:h") =~? '\<chroniq\>'
      let b:unaryTagsStack = 'BR'
      let b:unaryTagsStack = ""
      runtime! macros/closetag.vim

      Best regards,
    Your message has been successfully submitted and would be delivered to recipients shortly.