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

Re: using /foo/;/foo/e

Expand Messages
  • Bram Moolenaar
    ... It s not a bug. Try this: /foo/e Start with the cursor at the start of foo . You will notice it moves to the end of the same word. Thus using
    Message 1 of 2 , Aug 9, 2001
    • 0 Attachment
      Richard P. Groenewegen wrote:

      > This puzzles me. Consider the following `sentence':
      >
      > one two three four five
      >
      > and let's say the cursor is on `one'.
      >
      > /two/;/four/e<CR> leaves the cursor on the 'r' of 'four',
      > as expected.
      >
      > Now consider the following sentence
      >
      > one foo three foo five
      >
      > In this case
      >
      > /foo/;/foo<CR> leaves the cursor on the 'f' of the second
      > `foo', as expected.
      > /foo/;/foo/e<CR> leaves the cursor on the second 'o' of the
      > first `foo'. This was unexpected.
      >
      > Can someone explain, or is this a bug?

      It's not a bug. Try this:

      /foo/e

      Start with the cursor at the start of "foo". You will notice it moves to the
      end of the same word. Thus using "/foo/;/foo/e" first moves to the start of
      "foo" and then to the end of the same "foo".

      The reason is that a search will always move the cursor forward, but it may
      find a match under the current cursor position.

      --
      Not too long ago, compress was something you did to garbage...

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    Your message has been successfully submitted and would be delivered to recipients shortly.