Sunday, October 6, 2019

Re: sed whole file

Jorge Almeida wrote:

> I just noticed an obnoxious behaviour that I think is a new "feature".
> Or maybe it was always like this and I forgot. Or maybe I did
> something wrong, in which case I apologize in advance.
>
> It goes like this:
> I want to replace each occurrence of "foo" by "bar". In command mode I
> start typing
> :%s/foo
>
> and the cursor moves to the first occurrence of foo, even if it means
> moving the page down. Maybe the user would like to copy something in
> the original page? Maybe that's where the string "bar" occurs and the
> user didn't memorize it?
>
> Please help me to restore a sane behaviour

You can reset 'incsearch'.

Perhaps we could go back to the original view when typing the search
separator. So long as the user is typing the search pattern it is
useful to show the match, but when typing ":%s/foo/", thus starting to
type the replacement, it is useful to jump back?

I actually cannot guess if the user wants to see the original text or
the context of what is going to be replaced. If you have something
specific, you can copy it beforehand. And the jumping around can be
annoying. Thus I rather leave it like it is.

--
Save the plankton - eat a whale.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201910061025.x96APKFo032403%40masaka.moolenaar.net.

No comments: