Temporarily disable tab completion in Scala Repl

后端 未结 1 786
北恋
北恋 2021-01-20 06:33

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 t

1条回答
  •  北海茫月
    2021-01-20 07:07

    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

    0 讨论(0)
提交回复
热议问题