【问题标题】:Temporarily disable tab completion in Scala Repl在 Scala Repl 中暂时禁用制表符补全
【发布时间】:2014-04-01 14:47:57
【问题描述】:

我偶尔会使用带有硬制表符而不是空格的代码。是否有任何 repl 命令来指示解释器至少暂时将制表符处理为普通空格 - 沿着 :paste 的行?

【问题讨论】:

    标签: scala read-eval-print-loop


    【解决方案1】:

    确实:paste 听起来是个不错的选择,但如果您真的想覆盖键绑定,您可以提供自己的设置文件,如下所示:

    scala -Djline.keybindings=myfile
    

    我从默认 scala jar 中查找的文件格式如下:

    来自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 的命令替换为空字符串。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-26
      • 1970-01-01
      • 2016-02-10
      • 2011-04-02
      相关资源
      最近更新 更多