[Solved] Cannot use :paste in scala3-repl

Hi there, I am a big fan of scala and exciting about new scala 3. I already installed coursier and type this command $cs setup --jvm adopt:11 following this setup.

Then, I recognize that it is scala 2.13, so I use this command $cs install scala3-compiler and $cs install scala3-repl following dotty docs.

The issue is here, when I tried to use repl using $scala, the welcome prompt showed that is is scala version 2.13.6 which can use :paste just fine. But for repl scala 3 version using scala3-repl, it seems that I can’t use :paste as shown in the figure below. I wonder why?

Actually, I would like the default $scala command to access scala3 version repl like in this online book. How can I do this?

Thanks in advance everyone :smile:.

1 Like

:paste is not implemented but it’s also not really needed because multi-line pasting is supported by the scala 3 REPL.


Oh, Thanks a bunch!

Note that :paste isn’t that useful in Scala 2 anymore either. Since 2.13.2 the Scala 2 REPL has supported multiline paste as well.

However they don’t support newline without committing, as far as I know.

1 Like

They do. On MacOS it’s option-return, not sure what modifier key it is on Windows or Linux.

1 Like

That doesn’t seem to work by default though.

Probably keyboard - Using the Option key properly on Mac terminal - Super User ?

1 Like

Aha, configuring “left option key” as Esc+ in iTerm2 does the trick.

Eventually you could use a block definition
trait A
case object B extends A

Came here looking for paste mode: multi-line doesn’t seem to work properly.
Tried pasting in

 class Foo:

  val x = 123

  def bar = ???

  def baz = ??? 

and get

scala> class Foo:
     |   val x = 123
// defined class Foo

scala>   def bar = ???
def bar: Nothing


scala>   def baz = ???