问题
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