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

Re: Xemacs-like expression hilighting?

Expand Messages
  • A. J. Mechelynck
    ... 1. If you think that all Vim users know the meaning of Xemacs-like expression hilighting , then try again. If you explained what it does, with no
    Message 1 of 9 , Nov 4, 2005
    • 0 Attachment
      Geoffrey Alan Washburn wrote:
      > Is there a way to do Xemacs-like expression hilighting in Vim? As a
      > bonus is there a way to handle delimiters other than parens?

      1. If you think that all Vim users know the meaning of "Xemacs-like
      expression hilighting", then try again. If you explained what it does,
      with no reference to "that other editor", we might be able to understand
      what you mean, and thus, whether or not Vim has got it.

      2. There are ways to handle delimiters other than (), see for instance
      ":help object-motions" and ":help various-motions". For more complex
      delimiters (e.g., <b> and </b>), you may have to install the matchit plugin.

      Best regards,
      Tony.
    • Geoffrey Alan Washburn
      ... Well, I imagined all Vim did not live in a vacuum either, but I suppose it is worth going into more detail. Xemacs has a mode where if you place the
      Message 2 of 9 , Nov 4, 2005
      • 0 Attachment
        A. J. Mechelynck wrote:

        > 1. If you think that all Vim users know the meaning of "Xemacs-like
        > expression hilighting", then try again. If you explained what it does,
        > with no reference to "that other editor", we might be able to understand
        > what you mean, and thus, whether or not Vim has got it.

        Well, I imagined all Vim did not live in a vacuum either, but I suppose
        it is worth going into more detail. Xemacs has a mode where if you
        place the cursor on a paren, it will hilight the text to the matching
        paren, if it exists. Ideally, such functionality in Vim would not
        conflict with other standing hilights.
      • A. J. Mechelynck
        ... Place the cursor on a paren (or bracket or brace), then v% will highlight everything between it and its mate. Or place the cursor inside a () pair, and va(
        Message 3 of 9 , Nov 4, 2005
        • 0 Attachment
          Geoffrey Alan Washburn wrote:
          > A. J. Mechelynck wrote:
          >
          >> 1. If you think that all Vim users know the meaning of "Xemacs-like
          >> expression hilighting", then try again. If you explained what it does,
          >> with no reference to "that other editor", we might be able to understand
          >> what you mean, and thus, whether or not Vim has got it.
          >
          > Well, I imagined all Vim did not live in a vacuum either, but I
          > suppose it is worth going into more detail. Xemacs has a mode where if
          > you place the cursor on a paren, it will hilight the text to the
          > matching paren, if it exists. Ideally, such functionality in Vim would
          > not conflict with other standing hilights.
          >
          >
          >

          Place the cursor on a paren (or bracket or brace), then v% will
          highlight everything between it and its mate. Or place the cursor inside
          a () pair, and va( will highlight the text from the cursor, left and
          right to the nearest matching pair of parens. See ":help motion.txt" in
          general, and the same help items as those I mentioned in answer to part
          2 of your question in particular.

          If you set the 'showmatch' option on, when you place the cursor on a
          paren (or on a bracket or brace), the cursor will briefly jump to its
          mate if it is visible onscreen (see ":help 'showmatch'").

          And BTW, ask on an Emacs group if Emacs can use Vim regular expressions
          (as opposed to, for instance, Perl regular expressions), and I guess you
          will get the same blank stares from most of the people there, regardless
          of whether or not Emacs users "live in a vacuum".

          Best regards,
          Tony.
        • Geoffrey Alan Washburn
          ... These don t operate as I described though. I would like to move the cursor onto a delimiter and have it highlight to matching delimiter automatically and
          Message 4 of 9 , Nov 4, 2005
          • 0 Attachment
            A. J. Mechelynck wrote:

            > Place the cursor on a paren (or bracket or brace), then v% will
            > highlight everything between it and its mate. Or place the cursor inside
            > a () pair, and va( will highlight the text from the cursor, left and
            > right to the nearest matching pair of parens. See ":help motion.txt" in
            > general, and the same help items as those I mentioned in answer to part
            > 2 of your question in particular.
            >
            > If you set the 'showmatch' option on, when you place the cursor on a
            > paren (or on a bracket or brace), the cursor will briefly jump to its
            > mate if it is visible onscreen (see ":help 'showmatch'").


            These don't operate as I described though. I would like to move the
            cursor onto a delimiter and have it highlight to matching delimiter
            automatically and not move the cursor as v% does. Show match only
            operates when introducing a delimiter. Maybe I wasn't clear enough in
            my original description.
          • Charles E. Campbell, Jr.
            ... Hello! The plugin HiMtchBrkt , available at http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs as Highlighting Matching Brackets will highlight
            Message 5 of 9 , Nov 4, 2005
            • 0 Attachment
              Geoffrey Alan Washburn wrote:

              > ... Xemacs has a mode where if you place the cursor on a paren, it
              > will hilight the text to the matching paren, if it exists. Ideally,
              > such functionality in Vim would not conflict with other standing
              > hilights.
              >
              Hello!

              The plugin "HiMtchBrkt", available at

              http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
              as "Highlighting Matching Brackets"

              will highlight the matching bracket: (){}[] when the cursor
              is atop one of them.

              Regards,
              Chip Campbell
            • Charles E. Campbell, Jr.
              ... Given that, I m not particularly surprised that it didn t highlight matching delimiters after you disabled it with an :HMBstop. To use it, enable it
              Message 6 of 9 , Nov 4, 2005
              • 0 Attachment
                Geoffrey Alan Washburn wrote:

                > Hi, this doesn't seem to do what I was asking either,
                > unfortunately. I'm not asking for the matching delimiter to be
                > highlighted, but the delimiters and the enclosing expression. Plus,
                > the behavior I observed from the plug-in did not seem to match the
                > advertised behavior regardless. After invoking HMBstart, it only
                > seems to invoke the first matching delimiter that it seems and even
                > after a HMBstop, will not highlight another.

                :HMBstart enables the plugin.
                :HMBstop disables the plugin.

                Given that, I'm not particularly surprised that it didn't highlight
                matching delimiters after you disabled it with an :HMBstop. To use it,
                enable it (:HMBstart), and then move the cursor about.

                I assume you want the background highlighted differently between
                matching brackets, while the cursor is in that region? HiMtchBrkt won't
                do that. Vim doesn't currently support modifying a background
                independently of the syntax highlighting. I believe its a todo item for
                vim 7.0, however. Those who want the current line's background color
                changed have a similar wish.

                Now, if you want all {...} regions to have different highlighting, that
                could be done currently, but it would supercede normal syntax highlighting.

                Regards,
                Chip Campbell
              • Charles E. Campbell, Jr.
                ... Actually, I think that was what you described, if perhaps not what you meant. Here s the quote... After invoking HMBstart, it only seems to invoke the
                Message 7 of 9 , Nov 10, 2005
                • 0 Attachment
                  Geoffrey Alan Washburn wrote:

                  > Charles E. Campbell, Jr. wrote:
                  >
                  >>
                  >> :HMBstart enables the plugin.
                  >> :HMBstop disables the plugin.
                  >>
                  >> Given that, I'm not particularly surprised that it didn't highlight
                  >> matching delimiters after you disabled it with an :HMBstop. To use
                  >> it, enable it (:HMBstart), and then move the cursor about.
                  >
                  >
                  > That wasn't what I described.


                  Actually, I think that was what you described, if perhaps not what you
                  meant. Here's the quote...
                  "After invoking HMBstart, it only seems to invoke the first matching
                  delimiter that it seems and even after a HMBstop, will not highlight
                  another."

                  > If I type "( foo )" in insert mode, invoke HMBstart, and move the
                  > cursor to the left paren, the right paren will be highlighted. If I
                  > enter more text giving "( foo ) ( bar )" if I move cursor onto the
                  > second left paren it still highlights the first right paren. If I
                  > invoke HMBstop and then HMBstart again it will still only highlight
                  > the first right paren.


                  I don't see that behavior. When one types () in insert mode, they are
                  not highlighted; HiMtchBrkt highlights matching
                  parentheses when the cursor is atop a parenthesis. So, as one types in
                  insert mode, the cursor is moved to the right
                  (well, normally; I believe that one can reverse that), so it isn't atop
                  a bracket. Try moving the cursor atop the parentheses.

                  >> I assume you want the background highlighted differently between
                  >> matching brackets, while the cursor is in that region?
                  >
                  >
                  > Not exactly. I'm looking for the region between the delimiters to
                  > be hilighted just when the cursor is on a delimiter.


                  If you want the region to be highlighted, I could probably get
                  HiMtchBrkt to do it using the :match command. However, that
                  would all be highlighted one way, not background color only.

                  Regards,
                  Chip Campbell
                • Gareth Oakes
                  Hi there, I don t know if it s worth revisiting this point, but Geoff may get some mileage from my new recently-discovered command match :) ... Obviously it
                  Message 8 of 9 , Nov 14, 2005
                  • 0 Attachment
                    Hi there,

                    I don't know if it's worth revisiting this point, but Geoff may get some
                    mileage from my new recently-discovered command "match" :)

                    Here's an example:

                    :match Search /{[^}]*}/

                    Obviously it won't deal with nested brackets well at all, but that and
                    the method of finding what sort of brackets to highlight are left as an
                    exercise for the reader :) As a plus, the "match" highlighting is
                    per-buffer and doesn't interfere with incremental search and search
                    highlighting.

                    Cheers,
                    Gareth


                    Charles E. Campbell, Jr. wrote:
                    > Geoffrey Alan Washburn wrote:
                    >
                    >> Charles E. Campbell, Jr. wrote:
                    >>
                    >>>
                    >>> :HMBstart enables the plugin.
                    >>> :HMBstop disables the plugin.
                    >>>
                    >>> Given that, I'm not particularly surprised that it didn't highlight
                    >>> matching delimiters after you disabled it with an :HMBstop. To use
                    >>> it, enable it (:HMBstart), and then move the cursor about.
                    >>
                    >>
                    >>
                    >> That wasn't what I described.
                    >
                    >
                    >
                    > Actually, I think that was what you described, if perhaps not what you
                    > meant. Here's the quote...
                    > "After invoking HMBstart, it only seems to invoke the first matching
                    > delimiter that it seems and even after a HMBstop, will not highlight
                    > another."
                    >
                    >> If I type "( foo )" in insert mode, invoke HMBstart, and move the
                    >> cursor to the left paren, the right paren will be highlighted. If I
                    >> enter more text giving "( foo ) ( bar )" if I move cursor onto the
                    >> second left paren it still highlights the first right paren. If I
                    >> invoke HMBstop and then HMBstart again it will still only highlight
                    >> the first right paren.
                    >
                    >
                    >
                    > I don't see that behavior. When one types () in insert mode, they are
                    > not highlighted; HiMtchBrkt highlights matching
                    > parentheses when the cursor is atop a parenthesis. So, as one types in
                    > insert mode, the cursor is moved to the right
                    > (well, normally; I believe that one can reverse that), so it isn't atop
                    > a bracket. Try moving the cursor atop the parentheses.
                    >
                    >>> I assume you want the background highlighted differently between
                    >>> matching brackets, while the cursor is in that region?
                    >>
                    >>
                    >>
                    >> Not exactly. I'm looking for the region between the delimiters to
                    >> be hilighted just when the cursor is on a delimiter.
                    >
                    >
                    >
                    > If you want the region to be highlighted, I could probably get
                    > HiMtchBrkt to do it using the :match command. However, that
                    > would all be highlighted one way, not background color only.
                    >
                    > Regards,
                    > Chip Campbell
                    >
                  Your message has been successfully submitted and would be delivered to recipients shortly.