Feature request: split view in script window

The one thing I feel is truly missing from R Studio is the option to have a split view in the script window. Working on long scripts can quickly become frustrating when having to jump back and forth between sections to refer to earlier code.

Being able to have a split view, much like MS Word has, would be a huge improvement to the user experience as you would no longer have to jump between different sections of a script.

Does View > Panes > Add Source Column help?

Also, if your script is so long that it is hard to navigate, then consider splitting it into functions in separate files. The tidyverse style guide for example suggests maximum function length of 70 lines.

Doesn't View>Panes>Add Source Column open a pane for a second script rather than letting you look at two locations of a single script?

Low tech solution: open the same script a second (or even third) time?

Doesn't seem to work. RStudio seems to realize that the file is already open. It appears that you can open a second instance of RStudio and the file is updated in both versions after you save changes. But I also would like two views in one instance of RStudio, as in Word.

The argument that no function should be longer than 70 lines is generally a good one because it is easier to understand flow of control, but it's not uncommon to have a long file where execution is linear.

Long-standing feature request: View different parts of a source file at the same time · Issue #2129 · rstudio/rstudio · GitHub.

Recommend adding upvotes to it. Even though this has been around a long time, we do actually try to pick off some of these highly requested issues when we can.

You cannot open a second copy from the Files pane, but you can using File > Open File.... If you first make the directory containing your script(s) the working directory, it saves some navigation when opening the second copy.

Um, I'm sure that everyone else knows how to do this...but how do I add an upvote?

Did not work for me. Even odder: After trying Paul's suggestion I did Open file in new column. RStudio opened a blank column with no controls so you can't even close it. Appears to be a bug. (Latest versions of RStudio and R on Windows 11.)

You'll need to be logged into GitHub, then go to this issue https://github.com/rstudio/rstudio/issues/2129 and click on the thumbs-up to add a vote.

1 Like

This is a long-standing issue: https://github.com/rstudio/rstudio/issues/9891.

RStudio actively tries to prevent you from opening the same file more than once, and this blank column is a quirk resulting from that.

I completely agree that this would be a useful addition, especially when working with longer scripts.

Being able to split the source editor and keep two different parts of the same file visible at the same time would make it much easier to compare functions, refer back to earlier code, or work on one section while keeping another section in view.

For larger R projects, constantly scrolling back and forth can become surprisingly disruptive. A split editor, similar to what many other code editors provide, would be a relatively small UI improvement with a big impact on productivity.

Hopefully this is something the RStudio team will consider adding in a future release.

1 Like