Replace all: stay where you are

When I do Replace all, it is quite annoying that (after this is done), I am moved to the end of the file. Is there an option to stay at the same spot in the script as I was prior to pressing the All button?

1 Like


Welcome to the RStudio community!

As far as I know, it is not possible to change that behavior. I think the reasoning behind moving to the end of the file is to visually confirm the whole file was evaluated. This is because if you have an active selection, and the the option "selection only" is checked, it will only change that part (and not move to the end), but if you forget to check this, it will still replace everything (despite selection) and thus jumping to the end so you know the whole document has been replaced.

I don't know if this is the creator's reason behind the behavior, but I have found it handy in the past when I only intended to change something in a selection, but forgot to check the box and was visually reminded that I replaced it in the whole script.

Hope this helps,

Not really, but this at least explains the behaviour in the first place. Thanks.

I discovered a hack: Select All and mark In Selection. :slight_smile: As @pieterjanvc says ... it will only change that part (and not move to the end)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.