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

Re: Jump within function

Expand Messages
  • kbosau@web.de
    ... Hi Tim, thanks for the explanation! I m a member this crowd too, so I simply added normal G$/^ to the function body and it turned out to work fine now.
    Message 1 of 10 , Nov 1, 2002
    • 0 Attachment
      On 31 Oct 2002 at 16:00, Tim Chase wrote:

      > > The most straightforward (but much too often overlooked, sadly) way to
      > > do this is just putting what you want as an Ex line address:
      > >
      > > 0;/^>/
      >
      > for the lazy ones in the crowd like myself, it seems to work fine without
      > the trailing slash. that one extra character can be a drag ;-) This even
      > has the nice advantage that it catches a > as the first character in a
      > file. Using gg/^> won't find that. (okay, so what you really need to do
      > for that one is to have search-wrapping on, and G$/^> to find the first
      > one in the file)

      Hi Tim, thanks for the explanation! I'm a member this crowd too, so I
      simply added "normal G$/^>" to the function body and it turned out to
      work fine now. Just one question: "search-wrapping"... What do I have
      to do to turn this feature on?

      Klaus
    • Piet Delport
      ... If it works, like you said, then you already have it on, but the relevant setting is wrapscan . I really urge you to reconsider and use the 0;/^ / method,
      Message 2 of 10 , Nov 1, 2002
      • 0 Attachment
        On Sat, 02 Nov 2002 at 04:52:30 +0100, kbosau@... wrote:
        > On 31 Oct 2002 at 16:00, Tim Chase wrote:
        >
        >>> The most straightforward (but much too often overlooked, sadly) way to
        >>> do this is just putting what you want as an Ex line address:
        >>>
        >>> 0;/^>/
        >>
        >> for the lazy ones in the crowd like myself, it seems to work fine without
        >> the trailing slash. that one extra character can be a drag ;-) This even
        >> has the nice advantage that it catches a > as the first character in a
        >> file. Using gg/^> won't find that. (okay, so what you really need to do
        >> for that one is to have search-wrapping on, and G$/^> to find the first
        >> one in the file)
        >
        > Hi Tim, thanks for the explanation! I'm a member this crowd too, so I
        > simply added "normal G$/^>" to the function body and it turned out to
        > work fine now. Just one question: "search-wrapping"... What do I have
        > to do to turn this feature on?

        If it works, like you said, then you already have it on, but the
        relevant setting is 'wrapscan'.

        I really urge you to reconsider and use the 0;/^>/ method, though. It's
        shorter, simpler, doesn't depend on 'wrapscan' being on, and will work
        even in vanilla Vi (and/or Vim compiled without +ex_extra).

        --
        Piet Delport
        Today's subliminal thought is:
      • Gumnos (Tim Chase)
        ... The germane option is wrapscan (:he ws) Depending on where you re doing this, there are times for both the G/^ and the ex version of :0;/^ I d use the
        Message 3 of 10 , Nov 2, 2002
        • 0 Attachment
          > Hi Tim, thanks for the explanation! I'm a member this crowd too, so I
          > simply added "normal G$/^>" to the function body and it turned out to
          > work fine now. Just one question: "search-wrapping"... What do I have
          > to do to turn this feature on?

          The germane option is "wrapscan" (:he ws)

          Depending on where you're doing this, there are times for both the G/^> and
          the ex version of :0;/^> I'd use the former when doing it by hand (while
          editing a document), and use the latter when putting it in a script. The
          latter is also more likely faster (not that it matters much for the trivial
          few cycles of processor difference that occur), as well as shorter to type
          in a script (no need to "normal" it). IIRC, wrapscan defaults to being on
          in vim, though I'm not sure about vanilla vi's behavior in this matter. I
          first learned about the G/^> from the fabulous tutorial (that not only
          teaches the basics like many sites do, but includes a number of great tips,
          tricks, hints, and crazy stunts one can pull off in vi) found at
          http://www.networkcomputing.com/unixworld/tutorial/009/009.html

          particularly, Part 4 on the substitute command. All good stuff :) hth

          -tim
        • kbosau@web.de
          ... Hi Tim! It s really fabulous. I didn t know this site yet but I guess everybody using this editor, for whatever reasons, should know this source. Already
          Message 4 of 10 , Nov 3, 2002
          • 0 Attachment
            On 2 Nov 2002 at 9:20, Gumnos (Tim Chase) wrote:

            > > Hi Tim, thanks for the explanation! I'm a member this crowd too, so I
            > > simply added "normal G$/^>" to the function body and it turned out to
            > > work fine now. Just one question: "search-wrapping"... What do I have
            > > to do to turn this feature on?
            >
            > The germane option is "wrapscan" (:he ws)
            >
            > Depending on where you're doing this, there are times for both the G/^> and
            > the ex version of :0;/^> I'd use the former when doing it by hand (while
            > editing a document), and use the latter when putting it in a script. The
            > latter is also more likely faster (not that it matters much for the trivial
            > few cycles of processor difference that occur), as well as shorter to type
            > in a script (no need to "normal" it). IIRC, wrapscan defaults to being on
            > in vim, though I'm not sure about vanilla vi's behavior in this matter. I
            > first learned about the G/^> from the fabulous tutorial (that not only
            > teaches the basics like many sites do, but includes a number of great tips,
            > tricks, hints, and crazy stunts one can pull off in vi) found at
            > http://www.networkcomputing.com/unixworld/tutorial/009/009.html

            Hi Tim!

            It's really fabulous. I didn't know this site yet but I guess
            everybody using this editor, for whatever reasons, should know
            this source. Already bookmarked...

            Thanks for the hint!

            Klaus

            PS: The email extension I worked on is now ready and it turned
            out to be very comfortable. Unfortunately not every email/news-
            client offers a comfortable way to involve an external editor,
            though most of the inbuilt ones are not even able to do the
            simplest things. Pegasus for instance, a mail program with,
            definitely, the most crappy editing extension I ever saw. Try
            out and you'll start to love even "notepad"... :-) Bye!
          Your message has been successfully submitted and would be delivered to recipients shortly.