javawindowscommand-line-interfacegit-bashjshell

How do I type a TAB character in jshell?


In jshell, typing the TAB key on my keyboard serves as both auto-completion, as well as lets you see a short view of the documentation.

How do I type a literal TAB character in jshell?

Sometimes, when writing some simple streaming code (java.util.stream.Stream), I want to indent lines so that I can quickly see how nested into the pipeline that I am.


Solution

  • Jshell will accept most of Linux shell key combinations so Ctrl + v and then TAB will insert a literal tab.
    More shortcuts.

    jshell> String a = "a   b";
    a ==> "a\tb"
    

    Tested on Bash.