因此在
Scala REPL中,我可以使用ctrl- {p,n,a,e}来执行前一行,下一行,行尾和行尾.但是,如果我不能使用ctrl-d进行转发删除,我很快就会发疯.
是否有可能以某种方式实现这一目标?
我正在使用Mac.
更新
将以下行添加到接受的答案中以获取ctrl- {a,e}.可以在jline2 repo jline2 repo at GitHub中找到更大的keybindings文件.
# CTRL-A: move to the beginning of the line 1=MOVE_TO_BEG # CTRL-E: move the cursor to the end of the line 5=MOVE_TO_END
UPDATE2
我刚刚安装了Scala 2.9.0.final,我可以确认ctrl-d现在正常工作.它是向前删除,除非它终止shell时是空行.
解决方法
这是一个非常小的键绑定属性文件,包括你想要的^ D:
# CTRL-B: move to the prevIoUs character 2: PREV_CHAR # CTRL-D: delete the prevIoUs character 4: DELETE_NEXT_CHAR # CTRL-F: move to the next character 6: NEXT_CHAR # BACKSPACE,CTRL-H: delete the prevIoUs character # 8 is the ASCII code for backspace and therefor # deleting the prevIoUs character 8: DELETE_PREV_CHAR # TAB,CTRL-I: signal that console completion should be attempted 9: COMPLETE # CTRL-J,CTRL-M: newline 10: NEWLINE # ENTER: newline 13: NEWLINE # CTRL-N: scroll to the next element in the history buffer 14: NEXT_HISTORY # CTRL-P: scroll to the prevIoUs element in the history buffer 16: PREV_HISTORY # CTRL-V: paste the contents of the clipboard (useful for Windows terminal) 22: PASTE # DELETE,CTRL-?: delete the prevIoUs character # 127 is the ASCII code for delete 127: DELETE_PREV_CHAR
scala -Djline.keybindings=/path/to/keybindings.properties
或者通过JAVA_OPTS传递它.您必须在Internet上查找存在哪些键绑定,并尝试:来自Scala的键绑定以查看默认值(但它不会反映您的实际键绑定).