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

34168Re: Visual block question

Expand Messages
  • Miroslaw Dobrzanski-Neumann
    Dec 11, 2003
    • 0 Attachment
      On Fri, Dec 12, 2003 at 01:07:02AM -0500, Pavol Juhas wrote:
      > On Thu, Dec 11, 2003 at 07:06:46PM -0800, iainduncan@... wrote:
      > > >
      > > > control-V to highlight the block, then :s/foo/bar/g
      > >
      > > That doesn't work because it will automatically extend the range of the
      > > command to the end of the line, while dropping the /g will only replace the
      > > first. So if for example I want to replace only the integers in question in
      > > the first four columns, the normal process is insufficient. This
      > ...
      > > The reason I posted to this list is because the manual specifically mentions
      > > this problem and says this may be changed in future versions of Vim. I can't
      > > figure out why that change wouldn't be a good idea, as it doesn't make sense
      > > to me to have Visual Block behave like non-block visual mode for search and
      > > replace. That sounded like a dev issue to me, sorry if should have been on the
      > > other list. If I were a good enough programmer, I'd make a patch for my own
      > > uses!
      >
      > 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

      Some time ago I have asked for pattern matching only in a block. But I got now
      answer.

      Search and replace works fine for me:
      :'<,'>s/a/b/g
      There seems to be no command for searching only. I've tried
      :'<,'>search (a)
      but but vim tells me: "search is not an editor command" althogh documented in
      eval.txt

      Would it be possible to implement such command?

      Regards
      --
      Mirosław Dobrzański-Neumann
      E-mail: mne@...

      This message is utf-8 encoded
    • Show all 13 messages in this topic