sublime插件
Posted tengba-2014
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sublime插件相关的知识,希望对你有一定的参考价值。
sublime插件
a.安装Package control
1. 直接用自带的选项功能来安装
tools--install packgage control
2. 爬虫脚本安装
import urllib.request,os,hashlib;
h = ‘6f4c264a24d933ce70df5dedcf1dcaee‘ + ‘ebe013ee18cced0ef93d5f746d80ef60‘;
pf = ‘Package Control.sublime-package‘;
ipp = sublime.installed_packages_path();
urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) );
by = urllib.request.urlopen( ‘http://packagecontrol.io/‘ + pf.replace(‘ ‘, ‘%20‘)).read();
dh = hashlib.sha256(by).hexdigest();
print(‘Error validating download (got %s instead of %s), please try manual install‘ % (dh, h))
if dh != h
else open(os.path.join( ipp, pf), ‘wb‘ ).write(by)
view--show console 或者 按ctrl+`调出console粘贴以上代码
中文镜像网站http://packagecontrol.cn/installation#st3
由于packagecontrol.io容易被墙,访问不稳定,所以需要将Sublime Text安装插件的地址改为中文镜像的地址:修改或新增channels地址
preferences--package settings--package control--settings-user 加入代码
"channels": [ "http://packagecontrol.cn/channel_v3.json" ]
如下:
{
"bootstrapped": true,
"channels": [ "http://packagecontrol.cn/channel_v3.json" , "http://cst.stu.126.net/u/json/cms/channel_v3.json"],
"debug": true,
"in_process_packages":
[
],
"installed_packages":
[
"Anaconda",
"ChineseLocalizations",
"Package Control",
"SideBarEnhancements",
"SublimeLinter-pug-lint",
"SublimeREPL",
"SublimeTmpl"
]
}
安装插件
preference--package control --输入ip
.SublimeREPL-在Sublime 3中运行解释器(Python + virtualenv)
设置快捷键,注意中括号
[{
//运行当前文件
"keys": ["f5"],
"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
},
},
{
//调试当前文件
"keys": ["f8"],
"caption": "SublimeREPL: Python - PDB current file",
"command": "repl_open",
"mnemonic": "D",
"args":
{
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-i", "-u", "-m", "pdb", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
},
}]
.SublimeTmpl-新建文件的模版插件
.ChineseLocaloztions--中文插件
.Bracket Highlighter--代码匹配,可匹配[], (), {}, “”, ”,高亮标记,便于查看起始和结束标记;使用:点击对应代码即可
以上是关于sublime插件的主要内容,如果未能解决你的问题,请参考以下文章