Launch Sublime Text 3 from the command line
2016-05-30 00:23
232 查看
使用Sublime Text 3在MAC的命令行下直接打开一个文件,方法在红色区域内:
Sublime Text 3 ships with a CLI called
By default you can't use this command line utility unless you do some fiddling.
The Sublime Text documentation on
this tool does explain where it's located (
in your load path (
The
link — or shortcut) that will allow you to run the
First up, check your own
mine returns:
As you can see the
Note: These instructions assume you're using the Terminal app out of the box, without ZSH or any fancy prompts like that. I trust you will be able to adapt these instructions yourself if you do.
Yes, I name the symlink
you should always be explicit. You should never have to type the full word anyway. Typing
the full name of the symlink.
按照上述命令把/Application下的sublime链接到/usr/local/bin/sublime下,就可以直接打开了,也不用配置.bash_profile
or
or even
Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your
the official instructions given by the Sublime team seems to recommend.
Have fun, Sublime is a great editor. Check out the most recent beta
release of Sublime Text 3.
原文链接:http://olivierlacan.com/posts/launch-sublime-text-3-from-the-command-line/
Sublime Text 3 ships with a CLI called
subl.
By default you can't use this command line utility unless you do some fiddling.
A word about the load $PATH
The Sublime Text documentation onthis tool does explain where it's located (
/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl) but it assumes you have
~/bin(or
/Users/username/)
in your load path (
$PATH) which is downright silly. There's a better way.
The
/usr/local/binis in the load path by default on OS X, so it's a much better place to symlink (create a symbolic
link — or shortcut) that will allow you to run the
sublutility from your Terminal app.
First up, check your own
$PATHby running:
echo $PATH. This is what
mine returns:
1 | /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin |
/usr/local/binpath is included by default on OS X.
Installation
Note: These instructions assume you're using the Terminal app out of the box, without ZSH or any fancy prompts like that. I trust you will be able to adapt these instructions yourself if you do.1 | ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime |
sublimeinstead of
sublbecause I believe
you should always be explicit. You should never have to type the full word anyway. Typing
sub+
Tabshould auto-complete
the full name of the symlink.
按照上述命令把/Application下的sublime链接到/usr/local/bin/sublime下,就可以直接打开了,也不用配置.bash_profile
Testing
Open a Terminal window and run:1 | sublime ~/Documents |
12 | cd sublime Documents/ |
12 | # to open the entire current directory sublime . |
Conclusion
Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your .bash_profilewhich
the official instructions given by the Sublime team seems to recommend.
Have fun, Sublime is a great editor. Check out the most recent beta
release of Sublime Text 3.
原文链接:http://olivierlacan.com/posts/launch-sublime-text-3-from-the-command-line/
相关文章推荐
- Windows系统下使用Sublime搭建nodejs环境
- JavaScript开发者必备的10个Sublime Text插件
- javascript iframe中打开文件,并检测iframe存在否
- MAC 系统如何使用 Sublime Text 2 直接编译运行 java 代码
- Sublime里直接运行PHP配置方法
- Powershell使用OpenFileDialog打开文件示例
- 图解Sublime Text3使用技巧
- 推荐几款用 Sublime Text 开发 Laravel 所用到的插件
- Web Inspector:关于在 Sublime Text 中调试Js的介绍
- Nodejs sublime text 3安装与配置
- ubuntu下使用sublime text时如何完美输入中文
- Sublime Text 3常用插件及安装方法
- Ubuntu下sublime中文无法输入的处理方案
- 将Sublime Text 2配置为Java的IDE的教程
- 解决windows下Sublime Text 2 运行 PyQt 不显示的方法分享
- win7 下搭建sublime的python开发环境的配置方法
- 教你如何将 Sublime 3 打造成 Python/Django IDE开发利器
- sublime安装支持go和html的插件
- Sublime Text2 和 gist 打造自己的代码片断库
- 【CF 应用开发大赛】Cloud Foundry 控制台(续)