-2

In current session, I had set an external editor which I want to revert to default one. So, how to reset to default editor in jshell, in current sessoin?

EDIT:

I searched on net and found this link cr.openjdk.java.net/~rfield/tutorial/JShellTutorial.html which didn't help. I tried with DEFAULT as an option(guessing on the lines of default startup script), didn't help.

lupchiazoem
  • 8,026
  • 6
  • 36
  • 42
  • 2
    Did you bother to **read the [documentation](https://docs.oracle.com/javase/9/tools/jshell.htm#GUID-C337353B-074A-431C-993F-60C226163F00__GUID-109EA643-EB52-452B-82EF-FF8C140F581E)**? Or is it just easier to ask a question and have others read it for you? – Andreas Jan 21 '19 at 04:31
  • @Andreas I did try before posting. I searched on net and found this link https://cr.openjdk.java.net/~rfield/tutorial/JShellTutorial.html which didn't help. I tried with DEFAULT as an option(guessing on the lines of default startup script). ▲your comment and if you post an appropriate answer, I will accept it. – lupchiazoem Jan 21 '19 at 06:40
  • I added a step-by-step answer. If this doesn't answer your problem, please explain what you did, what you tried, what is the current and what is your expected result. – SubOptimal Jan 21 '19 at 08:16
  • Could you please leave a note if your problem was solved or not. If not provide the steps to reproduce the issue. This helps others which find your question and looking for a solution. – SubOptimal Jan 22 '19 at 07:42
  • SubOptimal, Read my earlier comment. You seem to be eager to get your answer accepted. I agree that your answer is correct but, I want to give a chance to @Andreas to have answer karma which I had intimated in my comment. – lupchiazoem Jan 22 '19 at 10:11
  • I don't intend to write an answer. Accept SubOptimal's answer, or delete the question, either way is fine by me. – Andreas Jan 22 '19 at 17:43
  • I don't care about if you accept the answer or not. But not leaving a comment, for others finding your question, if your issue was solved or not makes it less useful. There are too many orphaned questions with answers and no feedback from the original posters on SO. – SubOptimal Jan 23 '19 at 07:10

1 Answers1

1

As @Andreas said. It's written in the documentation.

Find below working steps (assuming you did not use an environment variable to change the default editor)

  • set an alternative editor

    jshell> /set editor your-editor
    |  Editor set to: your-editor
    
  • enter some snippet (only for demonstration)

    jshell> String foo = "foobar"
    foo ==> "foobar"
    
  • edit the snippet

    jshell> /edit foo
    

    this opens your-editor with the snippet String foo = "foobar";

  • set the editor back to default

    jshell> /set editor -default
    |  Editor set to: -default
    
  • edit the snippet

    jshell> /edit foo
    

    this opens JShell Edit Pad with the snippet String foo = "foobar";

SubOptimal
  • 22,518
  • 3
  • 53
  • 69