macos IntelliJ:如何从命令行打开现有 IntelliJ 中的文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2695820/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:54:19  来源:igfitidea点击:

IntelliJ: how to open files in an existing IntelliJ from the command line

macoscommand-lineintellij-idea

提问by avernet

I always have an IntelliJ running. Sometimes I want to open a file from outside IntelliJ. I can drag and drop a file to IntelliJ if am in the Finder, but if I am on the command line on OS X, how can I instruct IntelliJ to open a certain file? I am looking for something similar to the matecommand provided by TextMate.

我总是运行 IntelliJ。有时我想从 IntelliJ 外部打开一个文件。如果在 Finder 中,我可以将文件拖放到 IntelliJ,但是如果我在 OS X 的命令行上,我如何指示 IntelliJ 打开某个文件?我正在寻找类似于mateTextMate 提供的命令的东西。

回答by Timothée Jeannin

It's actually already implemented in the linuxand OS Xversion of IntelliJ IDEA.

它实际上已经在IntelliJ IDEAlinuxOS X版本中实现了。

Tools > Create Command-line Launcher...

Not sure it's available for windows.

不确定它是否适用于 Windows。

回答by avernet

Edit your ~/.bash_profileadding the following, changing the path to version of IntelliJ you'd like to use:

编辑~/.bash_profile添加以下内容,更改您要使用的 IntelliJ 版本的路径:

alias "ij=open -a /Applications/IntelliJ\ IDEA\ 9.0.2.app"

Then from the command line, open files with ij your-file.txt.

然后从命令行,打开带有ij your-file.txt.

回答by Klas Mellbourn

ideais the command you are looking for.

idea是您要查找的命令。

At least if you install "IntelliJ IDEA Ultimate", it will create the command ideaby default in /usr/local/bin/

至少如果你安装“IntelliJ IDEA Ultimate”,它会idea默认在/usr/local/bin/