在 Scala Repl 中暂时禁用制表符补全 [英] Temporarily disable tab completion in Scala Repl
问题描述
我偶尔会使用带有硬制表符而不是空格的代码.是否有任何 repl 命令指示解释器至少暂时将选项卡作为普通空格处理 - 沿着 :paste 行?
I occasionally work with code that has hard tabs instead of spaces. Is there any repl command to instruct the interpreter to process the tabs as normal whitespace at least temporarily - along the lines of :paste ?
推荐答案
确实 :paste
听起来是个不错的选择,但如果你真的想覆盖键绑定,你可以提供你自己的设置文件,如下所示:
Indeed :paste
sounds like a good option but if you really want to override keybindings you can provide your own settings file like this:
scala -Djline.keybindings=myfile
我从默认的scala jar里查到的文件格式是这样的:
The format of the file that I looked up from default scala jar is like this:
来自 jline.jar
中的文件 scala/tools/jline/keybindings.properties
:
# Keybinding mapping for JLine. The format is:
# [key code]=[logical operation]
# CTRL-A: move to the beginning of the line
1=MOVE_TO_BEG
# CTRL-B: move to the previous character
2=PREV_CHAR
# CTRL-D: close out the input stream
4=EXIT
# CTRL-E: move the cursor to the end of the line
5=MOVE_TO_END
# CTRL-F: move to the next character
6=NEXT_CHAR
# CTRL-G: abort
7=ABORT
# 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
将匹配选项 9 的命令替换为空字符串.
Replace the command matching option 9 with empty string.
http://www.scala-sbt.org/release/docs/Howto/interactive.html#change-keybindings
这篇关于在 Scala Repl 中暂时禁用制表符补全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!