[Rd] Treat multiline expressions as a single block in R Console history #1666

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Sat Oct 3 13:38:33 CEST 2026


Put this function in your .Rprofile file:

compress_clipboard <- function(sep = " ") {
  readLines("clipboard") |> paste(collapse = sep) |> writeClipboard()
}

and then run:

compress_clipboard()

before pasting.  Depending on what is on the clipboard you may need to
supply a different sep argument.

On Fri, Oct 2, 2026 at 5:03 PM SOEIRO Thomas via R-devel
<r-devel using r-project.org> wrote:
>
> Dear all,
>
>
> When copy-pasting a multiline expression into R in a console, the expression is treated as a single block in the history on Linux, but not on Windows.
>
>
> For example, when copy-pasting
>
>
> c(
>
>   1,
>
>   2
>
> )
>
>
> into R then pressing enter arrow up, I get the entiere expression on Linux, but only `)` on Windows.
>
>
> Is it expected? Can it be improved? If so, is it suitable for a Bugzilla wishlist item?
>
>
> Thanks,
>
> Thomas
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-devel mailing list