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

atom . (opens folder)

atom file.js (opens file)

atom (opens editor)

这是可能的吗?我如何设置它?


当前回答

在shell配置文件中添加路径(:/usr/local/bin/)。

Mac:文件$home/.bash_profile

export PATH=$GOPATH/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:$PATH

其他回答

转到您的终端并找到您的目录。执行如下命令:

atom index.html 

html只是一个例子。

使用user3283997的解决方案,或者在Atom中,选择Atom→安装Shell命令的菜单选项。这将在/usr/local/bin中创建两个符号链接。

apm -> /Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm
atom -> /Applications/Atom.app/Contents/Resources/app/atom.sh

atom命令可以让您完成您所要求的事情。Apm是命令行包管理器。

在macOS上,您可以将其添加到~/.bash_profile中

as

别名 atom='open -a 'Atom''

然后从终端调用

原子filename.whatever

符号链接解决方案停止为我在zsh今天工作。我最终在我的.zshrc文件中创建了一个别名:

alias atom='sh /Applications/ atom. app/Contents/Resources/app/atom.sh'

由于Atom在从命令行启动时无法写入其日志文件,我遇到了一些问题。这样就治好了。

sudo chmod 777 ~/.atom/nohup.out