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

RE: regex repetition quantifier * in vim

Expand Messages
  • Bowie Bailey
    From: qlerner@netvision.net.il [mailto:qlerner@netvision.net.il] ... This still doesn t get it all. It misses the last character of the match. Using the same
    Message 1 of 7 , Mar 30 9:18 AM
    • 0 Attachment
      From: qlerner@... [mailto:qlerner@...]
      > Bowie Bailey wrote:
      > > From: qlerner@... [mailto:qlerner@...]
      > > >You can refer specifically to the match at which
      > > >cursor is positioned. The command is:
      > > > v//e
      > >
      > > This sounds interesting, but it doesn't seem to work for me.
      > > .... What it seems to do for me is highlight everything from
      > > where the cursor currently is to one character from the end of the
      > > match.
      > That's right; v//e assumes that cursor is on the 1st character
      > of the match.
      > Here is the mapping that selects whole current match no matter
      > where the cursor is inside the match:
      > map <F9> l??b<CR>v//e<CR>

      This still doesn't get it all. It misses the last character of the

      Using the same example:

      the match

      In order to get it to work properly, I needed this map:

      map <F9> l??b<CR>v//e<CR>l

      Ahh...after poking around a bit, I found the problem:

      set selection=exclusive

      Your map only works properly if selection is set to "inclusive" (which
      is the default).

      Thanks for the tip. I didn't know you could extend a visual block by
      searching this way. With Vim, there's always something new.

    Your message has been successfully submitted and would be delivered to recipients shortly.