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

34165Re: Visual block question

Expand Messages
  • Iain Duncan
    Dec 11, 2003
      > I think it is not that simple to implement visual block
      > search/replace. For set ve=all you can extend the selection
      > beyond existing text - should :s treat this as spaces? What about
      > matches that cross the end of visual block - should they be
      > matched? I suspect learning vim regular expressions would be much
      > easier than writing a patch. For example to match Pattern after
      > the 15th column use
      > /\%>15cPattern/
      > to match after 15th virtual column use
      > /\%>15cPattern/
      > or to match pattern that comes rigth after "foo:"
      > /\(foo:\)\@<=Pattern

      I've thought of ways to hack around it myself too, but I still can't see why
      visual block should set a range that doesn't actually match the visual
      block! Does anyone think this is something that may or could be fixed? I'm
      debating whether it will be easier to just do the grid editor in Emacs,
      which I would prefer not to do because I like Vim a lot better. But grabbing
      rectangular blocks, processing them, and having them automatically replaced
      is pretty much going to be most of the work done in this thing, and the
      whole purpose is to make that as fast as possible. So for example perhaps
      there are 16 columns by 128 lines, one should be able to quickly select any
      block of that and pass it to a command, or do a replacement, or do some
      math, etc, etc. Having to repeat the process for each column will be a pain.
      Visual block is nicely integrated with mouse support and key selecting.

      As far as I can tell, the only thing working the way I would expect it to is
      yanking, so the other hack I thought of was yanking the area to a temp
      buffer, running the script on that buffer, and then putting the content from
      the temp buffer back into the main one. But I would think that making Visual
      Block act like a functional range indicator would be a handy feature for all
      kinds of other purposes too.

      Anyway, thanks everyone for all the alternate solutions, and please do let
      me know if this is something that may change in future version.

    • Show all 13 messages in this topic