Sublime Text包括一个命令行工具,subl,在命令行上的文件工作。这可以用来在Sublime Text打开的文件和项目,以及工作作为EDITOR用于UNIX工具,如Git和颠覆。
第一个任务是使一个符号链接subl。假设你已经放置在应用程序文件夹Sublime Text,并且您有一个〜/ bin中在路径的目录,你可以运行:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
运行subl --help,
Usage: subl [arguments] [files] edit the given files or: subl [arguments] [directories] open the given directories or: subl [arguments] - edit stdin Arguments: --project <project>: Load the given project --command <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 --wait is implied if reading from stdin. Use --stay to not switch back to the terminal when a file is closed (only relevant if waiting for a file). Filenames may be given a :line or :line:column suffix to open at a specific location.
要使用文本崇高的编辑器的许多命令,提示输入,设置EDITOR环境变量:
export EDITOR='subl -w'
指定-w将导致subl命令不会退出,直到该文件被关闭。