java - 如何将sublime设置为jshell的外部编辑器?

标签 java macos editor java-9 jshell

根据 jshell 文档:

An alternative to editing at the command prompt is to use an external editor. This editor can be used to edit and create snippets, and is especially helpful for multiline snippets. You can configure JShell to use the editor of your choice.

因此,为了实现这一点,我使用了以下命令:

jshell> /set editor sublime
|  Editor set to: sublime

然后,我尝试按如下方式编辑片段:

jshell> /edit printName
|  Edit Error: process IO failure: Cannot run program "subllime": error=2, No such file or directory

但是,我得到了上面的错误。 那么它是设置编辑器的正确方法还是需要其他东西? 我还尝试将 Microsoft Word 设置为编辑器,并从 Mac 的应用程序文件夹中指定确切的应用程序路径,如下所示:

jshell> /set editor /Users/karan.verma/Applications/Microsoft Word.app
|  Editor set to: /Users/karan.verma/Applications/Microsoft Word.app

甚至,当我将编辑器设置为“atom”时,我得到了相同的结果:

jshell> /set editor atom
|  Editor set to: atom

但它仍然显示相同的错误。有帮助吗?

最佳答案

可能不适用于 OP。但为我工作。所以,将其张贴在这里,希望对某人有所帮助。

如果您可以在终端上键入 subl 并且 Sublime Text 打开(意味着 sublPATH 中),请尝试:

/set editor subl -w

如果在终端上输入 subl 时 Sublime Text 没有打开,但是运行 "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" 可以打开 Sublime Text(意味着 subl 不在 PATH 中),尝试:

/set editor "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" -w

-w标志是等待文件在Sublime Text中关闭后再返回。

关于java - 如何将sublime设置为jshell的外部编辑器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47866775/

相关文章:

Java死锁挑衅

editor - 如何强制 SciTE 自动重新加载文件?

能够在 IE6、IE7、Safari 3 中预览的 CSS 编辑器?

java - Maven文件夹布局: Should I place tests in the EAR or its sub-modules?

java - 如何检测两个linux路径何时引用maven中的同一个文件?

iphone - iPhone 上的 Lua?

cocoa - 如何使用 Cocoa 将图像重叠(叠加)在文件图标上?

html - SVG foreignObject 中的 Div 在 Mac Chrome 中失去了位置

vim - 是否可以使用名为 vimfiles 的文件夹来替换 macvim 中的 .vim?

java - 自定义 ScrollPane 的绘画问题