离开岛的鱼

如何使用命令行快速打开sublime编辑器

2017/02/01

版权声明:本文为博主原创文章,未经博主允许不得转载。

建立软链:(如果是 sublime Text 2)

sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

建立软链:(如果是 sublime Text)

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

然后就可以用sublime命令打开文件了

sublime hello.txt

sublime –help
列出subl的常用命令集
–project : Load the given project
–command : Run the given command
-n or –new-window: Open a new window
-a or –add: Add folders to the current window
-w or –wait: Wait for the files to be closed before returning
-b or –background: Don’t activate the application
-s or –stay: Keep the application activated after closing the file
-h or –help: Show help (this message) and exit
-v or –version: Show version and exit

sublime 文件名
使用sublime打开文件

sublime -n 文件名
以新窗口打开文件

sublime -a 文件夹名
将当前文件夹添加到sublime当前窗口中

sublime -n 文件夹名
将当前文件夹添加到sublime的新窗口中