博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Launch Sublime Text 3 from the command line
阅读量:4196 次
发布时间:2019-05-26

本文共 1897 字,大约阅读时间需要 6 分钟。

使用Sublime Text 3在MAC的命令行下直接打开一个文件,方法在红色区域内:

Sublime Text 3 ships with a  called subl. By default you can't use this command line utility unless you do some fiddling.

A word about the load $PATH

The  on this 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/bin is in the load path by default on OS X, so it's a much better place to symlink (create a  — or shortcut) that will allow you to run the subl utility from your Terminal app.

First up, check your own $PATH by running: echo $PATH. This is what mine returns:

1
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

As you can see the /usr/local/bin path 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

Yes, I name the symlink sublime instead of subl because I believe you should always be explicit. You should never have to type the full word anyway. Typing sub + Tab should 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

or

12
cdsublime Documents/

or even

12
# to open the entire current directorysublime .

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_profile which the official instructions given by the Sublime team seems to recommend.

Have fun, Sublime is a great editor. Check out the most recent .

原文链接:

转载地址:http://nfyli.baihongyu.com/

你可能感兴趣的文章
Keras(六)keras模型封装转化为sklearn模型、使用超参数搜索
查看>>
排坑:TypeError: handle_get_file_code() got an unexpected keyword argument ‘save_all‘
查看>>
Keras(七)TF2中基础的数据类型API介绍
查看>>
Keras(八)实战自定义损失函数、DenseLayer
查看>>
Keras(九) tf.function函数转换、@tf.function函数转换
查看>>
Keras(十) TF函数签名与图结构
查看>>
Keras(十一)梯度带(GradientTape)的基本使用方法,与tf.keras结合使用
查看>>
Keras(十二)tf_data基础API使用
查看>>
Keras(十三)生成csv文件
查看>>
Keras(十四)tf.data读取csv文件并与tf.keras结合使用
查看>>
python之正则表达式方法详解
查看>>
Keras(十五)tf_record基础API使用
查看>>
Keras(十六)生成、读取tfrecords文件,并与tf.keras结合使用
查看>>
Keras(十七)关于feature_column的使用、keras模型转tf.estimator
查看>>
Keras(十八)预定义estimator使用、交叉特征实战
查看>>
Keras(十九)卷积神经网络实战
查看>>
Keras(二十)深度可分离卷积网络实战
查看>>
Keras(二十三)cifar10数据集使用keras generator读取、模型训练、预测
查看>>
Keras(二十五)NLP文本分类,序列式问题和循环神经网络模型理论
查看>>
Keras(二十六)NLP文本分类,单层单向RNN,单层双向RNN,双层双向 RNN的实现
查看>>