如何从 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 symbolic link in your /usr/local/bin folder. 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.