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

Problem with 'lisp' and commented sexps

Expand Messages
  • Yang
    There seems to be an undocumented feature when editing Lisp files with the lisp option set. I can no longer % between matching s-expressions []{}() if they
    Message 1 of 5 , Sep 2, 2006
    • 0 Attachment
      There seems to be an 'undocumented feature' when editing Lisp files
      with the 'lisp' option set. I can no longer % between matching
      s-expressions []{}() if they are in comments and on newlines, e.g. in:

      ;; myfold {{{
      (blah blah)
      ;; }}}

      ;; (blah
      ;; blah)

      I can't jump between the {} or the second (). Is this a bug?
    • A.J.Mechelynck
      ... Are you using matchit or plain % jumping? By default, matching ignores matches inside comments, see :help b:match_skip Best regards, Tony.
      Message 2 of 5 , Sep 2, 2006
      • 0 Attachment
        Yang wrote:
        > There seems to be an 'undocumented feature' when editing Lisp files
        > with the 'lisp' option set. I can no longer % between matching
        > s-expressions []{}() if they are in comments and on newlines, e.g. in:
        >
        > ;; myfold {{{
        > (blah blah)
        > ;; }}}
        >
        > ;; (blah
        > ;; blah)
        >
        > I can't jump between the {} or the second (). Is this a bug?
        >

        Are you using matchit or "plain" % jumping? By default, matching ignores
        matches inside comments, see ":help b:match_skip"


        Best regards,
        Tony.
      • Yang
        On 9/2/06, A.J.Mechelynck antoine.mechelynck-at-skynet.be |vim| ... I m not using matchit, I m using plain %. I didn t know about matchit; do I need to use
        Message 3 of 5 , Sep 2, 2006
        • 0 Attachment
          On 9/2/06, A.J.Mechelynck antoine.mechelynck-at-skynet.be |vim|
          <...> wrote:
          > Yang wrote:
          > > There seems to be an 'undocumented feature' when editing Lisp files
          > > with the 'lisp' option set. I can no longer % between matching
          > > s-expressions []{}() if they are in comments and on newlines, e.g. in:
          > >
          > > ;; myfold {{{
          > > (blah blah)
          > > ;; }}}
          > >
          > > ;; (blah
          > > ;; blah)
          > >
          > > I can't jump between the {} or the second (). Is this a bug?
          > >
          >
          > Are you using matchit or "plain" % jumping? By default, matching ignores
          > matches inside comments, see ":help b:match_skip"
          >
          >
          > Best regards,
          > Tony.
          >

          I'm not using matchit, I'm using plain %.

          I didn't know about matchit; do I need to use this instead of vim's
          built-in %, then? I just installed matchit, but when I tried letting
          b:match_skip = 's:string', nothing seemed to change.

          (In any case, this still doesn't explain the plain % behavior.)
        • A.J.Mechelynck
          ... You don t need to do anything; it s your choice. I use matchit because I prefer its more extensive choice of matched words depending on the underlying
          Message 4 of 5 , Sep 2, 2006
          • 0 Attachment
            Yang wrote:
            > On 9/2/06, A.J.Mechelynck antoine.mechelynck-at-skynet.be |vim|
            > <...> wrote:
            >> Yang wrote:
            >> > There seems to be an 'undocumented feature' when editing Lisp files
            >> > with the 'lisp' option set. I can no longer % between matching
            >> > s-expressions []{}() if they are in comments and on newlines, e.g. in:
            >> >
            >> > ;; myfold {{{
            >> > (blah blah)
            >> > ;; }}}
            >> >
            >> > ;; (blah
            >> > ;; blah)
            >> >
            >> > I can't jump between the {} or the second (). Is this a bug?
            >> >
            >>
            >> Are you using matchit or "plain" % jumping? By default, matching ignores
            >> matches inside comments, see ":help b:match_skip"
            >>
            >>
            >> Best regards,
            >> Tony.
            >>
            >
            > I'm not using matchit, I'm using plain %.
            >
            > I didn't know about matchit; do I need to use this instead of vim's
            > built-in %, then? I just installed matchit, but when I tried letting
            > b:match_skip = 's:string', nothing seemed to change.
            >
            > (In any case, this still doesn't explain the plain % behavior.)
            >

            You don't "need" to do anything; it's your choice. I use matchit because
            I prefer its more extensive choice of matched words depending on the
            underlying syntax. I don't have Lisp sources, but in HTML pages I see %
            jumping from ( to ) inside a comment or from < to > or <a to </a>
            outside comments but not between something in a comment and something
            that isn't. I'm not sure about jumping from one comment to another, but
            I see jumping happening from text to text, skipping a comment. I believe
            that this is the "normal" behaviour.

            If you don't see the equivalent in Lisp with the _default_ settings,
            then maybe your Lisp plugins are not matchit-aware?

            Mine (distributed with Vim 7) are:

            ftplugin/lisp.vim
            by Sergey Khorev (after Dorai Sitaram), Nov 8, 2004

            syntax/lisp.vim (version 17a)
            by Charles E. Campbell, Jr., Oct 12, 2005

            The former sets no matchit variables; the latter -- I'm not sure. Let's
            wait and see if these two people have something to say on this matter.


            Best regards,
            Tony.
          • Charles E Campbell Jr
            ... Its definitely controlled by the lisp option: (I put your example into yank.lsp) vim -u NONE -N yang.lsp (% key works on all {} and ()) ... (% key works
            Message 5 of 5 , Sep 6, 2006
            • 0 Attachment
              Yang wrote:

              > There seems to be an 'undocumented feature' when editing Lisp files
              > with the 'lisp' option set. I can no longer % between matching
              > s-expressions []{}() if they are in comments and on newlines, e.g. in:
              >
              > ;; myfold {{{
              > (blah blah)
              > ;; }}}
              >
              > ;; (blah
              > ;; blah)
              >
              > I can't jump between the {} or the second (). Is this a bug?
              >
              Its definitely controlled by the lisp option: (I put your example
              into yank.lsp)

              vim -u NONE -N yang.lsp
              (% key works on all {} and ())
              :syn on
              (% key works on all {} and ())
              :set lisp
              (problems you mentioned appear)

              Because of the -u NONE, the matchit plugin doesn't enter into this.
              The syntax file has no explicit interaction with matchit or %, so it
              appears to be an undocumented vim feature.

              Regards,
              Chip Campbell
            Your message has been successfully submitted and would be delivered to recipients shortly.