如何在OS X的命令行中打开Atom编辑器?

问题描述:

我有Atom编辑器,想知道如何从Atom终端中打开文件或文件夹.我正在使用Mac.我正在寻找一种方法来做到这一点:

I have the Atom editor and was wondering how you can open a file or folder from the terminal in Atom. I am using a Mac. I am looking for a way to do this:

atom . (opens folder)

atom file.js (opens file)

atom (opens editor)

这可能吗,我该如何设置?

Is this possible and how do I set it up?

在安装Atom时,它会在/usr/local/bin中自动创建一个符号链接.但是,如果没有,您可以在Mac上自己创建

When Atom installs it automatically creates a symlink in your /usr/local/bin. However in case it hasn't, you can create it yourself on your Mac

ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom

现在,您可以使用atom folder_name打开文件夹,使用atom file_name打开文件.希望这会有所帮助.

Now you can use atom folder_name to open a folder and atom file_name to open a file. Hope this helps.