Temporarily disable tab completion in Scala Repl

喜欢而已 提交于 2019-12-20 02:27:50

问题


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 ?


回答1:


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

The format of the file that I looked up from default scala jar is like this:

from file scala/tools/jline/keybindings.properties in jline.jar:

# 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

Replace the command matching option 9 with empty string.

http://www.scala-sbt.org/release/docs/Howto/interactive.html#change-keybindings



来源:https://stackoverflow.com/questions/22097896/temporarily-disable-tab-completion-in-scala-repl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!