Hi,

James Vega wrote:
> On Jan 16, 2008 8:39 AM, Jürgen Krämer <[EMAIL PROTECTED]> wrote:
>> The behaviour you want can be achieved with an additional script by
>> Dr. Chip. You can download it from the following url
> 
> In Vim7 you can also use the \%V operator as described at ":help
> /\%V".  This will limit the match to only the area selected by the
> visual block.

which is a bit awkward to use if you want to make sure that the search
text is completely inside the block, e.g.,

             +----+
  I. this is |foo |text
  II. this is| foo| text
  III. this i|s fo|o text
             +----+

with a 4x3 block (marked by lines)

  '<,'>s/\%Vfoo/bar/

replaces all three occurences of foo.

  '<,'>s/\%Vfoo\%V/bar/

only replaces the first one, because \%V only anchors the following
char to the visual block -- and the space after foo is outside of the
block.

  '<,'>s/\%Vfo\%Vo/bar/

works (i.e., replaces foo two times), but it is not very intuitive and
does not work in all cases, especially with multis:

             +---+
  I. this is |bar|r text
  II. this is| ba|rr text
  III. this i|s b|arr text
             +---+

  :'<,'>s/\%Vba\%Vr\+/foo/

yields

  I. this is foo text
  II. this is barr text
  III. this is barr text

Note that the first barr has been completely replaced by foo, although
the trailing r should have been kept.

You also cannot anchor the search text to the start of the visual block.
I guess special atoms would be needed that match before the first and
after the last column of a visual block.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us.     (Calvin)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui