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
IntelliJ: how to open files in an existing IntelliJ from the command line
提问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 mate
command provided by TextMate.
我总是运行 IntelliJ。有时我想从 IntelliJ 外部打开一个文件。如果在 Finder 中,我可以将文件拖放到 IntelliJ,但是如果我在 OS X 的命令行上,我如何指示 IntelliJ 打开某个文件?我正在寻找类似于mate
TextMate 提供的命令的东西。
回答by Timothée Jeannin
It's actually already implemented in the linuxand OS Xversion of IntelliJ IDEA.
它实际上已经在IntelliJ IDEA的linux和OS X版本中实现了。
Tools > Create Command-line Launcher...
Not sure it's available for windows.
不确定它是否适用于 Windows。
回答by avernet
Edit your ~/.bash_profile
adding 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
idea
is the command you are looking for.
idea
是您要查找的命令。
At least if you install "IntelliJ IDEA Ultimate", it will create the command idea
by default in /usr/local/bin/
至少如果你安装“IntelliJ IDEA Ultimate”,它会idea
默认在/usr/local/bin/