有没有办法在Scala的REPL中使用ctrl-d作为前向删除?
发布时间:2020-12-16 18:02:34 所属栏目:安全 来源:网络整理
导读:因此在 Scala REPL中,我可以使用ctrl- {p,n,a,e}来执行前一行,下一行,行尾和行尾.但是,如果我不能使用ctrl-d进行转发删除,我很快就会发疯. 是否有可能以某种方式实现这一目标? 我正在使用Mac. 更新 将以下行添加到接受的答案中以获取ctrl- {a,e}.可以在jlin
因此在
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: scala -Djline.keybindings=/path/to/keybindings.properties 或者通过JAVA_OPTS传递它.您必须在Internet上查找存在哪些键绑定,并尝试:来自Scala的键绑定以查看默认值(但它不会反映您的实际键绑定). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |