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

Not ignore parens in single quotes?

Expand Messages
  • yahoogroups@vikas.mailshell.com
    The default behaviour of the % movement command is to jump to the matching parens. It ignores any parens enclosed in single quotes. This makes it hard to debug
    Message 1 of 3 , Mar 1, 2002
      The default behaviour of the % movement command is to jump to the matching
      parens. It ignores any parens enclosed in single quotes.

      This makes it hard to debug Vim scripts and other scripts where I am
      constructing a string including '(' and so I *want* to NOT ignore these.

      Is there a way I can have Vim NOT ignore parens in single quotes for the
      purpose of the % command?

      Thanks

      __________________________________________________
      Do You Yahoo!?
      Yahoo! Greetings - Send FREE e-cards for every occasion!
      http://greetings.yahoo.com
    • Benji Fisher
      ... From your previous e-mail, I gather you are using matchit.vim. Make sure you have installed the docs. ... Then read up on configuring matchit, especially
      Message 2 of 3 , Mar 1, 2002
        yahoogroups@... wrote:
        >
        > The default behaviour of the % movement command is to jump to the matching
        > parens. It ignores any parens enclosed in single quotes.
        >
        > This makes it hard to debug Vim scripts and other scripts where I am
        > constructing a string including '(' and so I *want* to NOT ignore these.
        >
        > Is there a way I can have Vim NOT ignore parens in single quotes for the
        > purpose of the % command?
        >
        > Thanks

        From your previous e-mail, I gather you are using matchit.vim. Make sure
        you have installed the docs.

        :help add-local-help

        Then read up on configuring matchit, especially

        :help match_skip

        HTH --Benji Fisher
      • Benji Fisher
        ... From the docs: By default, words inside comments and strings are ignored, unless the cursor is inside a comment or string when you type % . If the
        Message 3 of 3 , Mar 4, 2002
          yahoogroups@... wrote:
          >
          > In the meanwhile, I found that
          >
          > set cpo+=%
          >
          > pretty much does what I want without breaking matchit.vim either.
          >
          > But on that note, I really couldnt comprehend :h match_skip.
          >
          > Does it specify match patterns to skip entirely for all the matching groups in
          > b:match_words? How would it apply here? It takes 2 things: a syntax item to
          > skip or a regexp pattern in the "previous" line? I read the docs but I really
          > didnt understand how to use it effectively.

          From the docs:

          By default, words inside comments and strings are ignored, unless
          the cursor is inside a comment or string when you type "%". If the
          [later]
          You can get the default behavior with
          :let b:match_skip = 's:comment\|string'

          If you do not want to ignore parentheses inside strings, try

          :let b:match_skip = 's:comment'

          or

          :unlet b:match_skip

          > Especially in the context below...
          >
          > Also, related to my previous question (PL/SQL), PL/SQL has the THEN keyword in
          > 2 places
          >
          > IF condition
          > THEN
          > END IF
          >
          > and also
          >
          > BEGIN
          > ..
          > EXCEPTION WHEN something THEN
          > END
          >
          > So the THEN keyword would appear in 2 "," separated groups in b:match_words.
          >
          > This causes matchit to get confused (rightly so). If it lands on a THEN it has
          > no way of knowing which group's rules it should follow, right?

          Right. If the "EXCEPTION...THEN" has to be on a single line, I think it
          will work if you put the

          BEGIN:EXCEPTION WHEN.\{-}THEN:END

          group before the

          IF:THEN:END IF

          group. (This is simplified.)

          > Can b:match_skip help here?

          I do not think so.

          > Thanks,
          > Vikas
          >
          > --- Benji Fisher <benji.at.e-math.ams.org@...>
          > wrote:
          > > > Is there a way I can have Vim NOT ignore parens in single quotes for the
          > > > purpose of the % command?
          > >
          > > Then read up on configuring matchit, especially
          > >
          > > :help match_skip

          HTH --Benji Fisher
        Your message has been successfully submitted and would be delivered to recipients shortly.