[英]In Scala REPL, how to discard partly written multi-line command?
On Unix Shell terminal, you can discard a typed command just by typing ctrl-c. 在Unix Shell终端上,只需键入ctrl-c即可丢弃键入的命令。 Is there a way to discard a typed command on Scala REPL? 有没有办法在Scala REPL上丢弃键入的命令?
Ctrl-C
still works but it would exit the Scala REPL, which is probably not what you prefer. Ctrl-C
仍然可以工作,但是它将退出Scala REPL,这可能不是您想要的。
A couple of cases: 几种情况:
Up
button then Down
to an empty command line. 如果您在单行命令的中间,则可以单击“ Up
按钮,然后单击“ Down
进入一个空命令行。 return
a couple of times to let the REPL interpret the consecutive blank lines as intention to start a new command. 如果您在多行命令中间,并且该命令不完整,则可以简单地按return
几次,以使REPL将连续的空白行解释为打算开始新命令。 But, in case you worry about whatever you've typed might get executed, safest way would still be to hit Ctrl-C
. 但是,如果您担心自己键入的内容可能会被执行,最安全的方法仍然是Ctrl-C
。 When you're writing an unfinished block you can enter two blank lines and the REPL will then skip your command and start a new one. 编写未完成的块时,您可以输入两个空白行,然后REPL将跳过您的命令并开始一个新的命令。
You may then still use up buttons to retrieve the lines you want to continue with in the new command. 然后,您仍然可以使用向上按钮在新命令中检索要继续的行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.