您的位置:首页 > 编程语言 > Python开发

sublime text 3搭建Python编程环境步骤

2015-07-26 19:42 731 查看
sublime text 3是我接触的第一款代码编辑器,记录下自己的插件设置。以后有可能的话去学学传说中的vim,emacs

首先下载,破解,汉化。引用腻害的人的博客:具体教程

之后是自己的配置文件Perferences->settings-users

{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Bright.tmTheme",
"font_size": 22,
"ignored_packages":
[
"Vintage"
],
"theme": "SoDaReloaded Dark.sublime-theme",
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
// If enabled, will highlight any line with a caret
"highlight_line": true,
// Makes tabs with modified files more visible
"highlight_modified_tabs": true,
// Display file encoding in the status bar
"show_encoding": true,
// Disables horizontal scrolling if enabled.
   // May be set to true, false, or "auto", where it will be disabled for
   // source code, and otherwise enabled.
   "word_wrap": "false",
}


安装Package Control,这个东东可以管理安装插件,有了它就不需要自己去下载安装插件啦~

Ctrl+`粘贴以下代码到底部命令行并回车:

{
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
}

重启Sublime Text 3。

不行的话:https://packagecontrol.io/installation#st3 这个是官方的

成功的话会在Perferences->package settings中看到package control这一项。

安装插件的方法:

按下Ctrl+Shift+P调出命令面板
输入install 调出 Install Package 选项并回车,然后在列表中选中要安装的插件。

尝试用的过的几个插件:

All Autocomplete:Sublime默认的Autocomplete功能只考虑当前的文件,而AllAutocomplete插件会搜索所有打开的文件来寻找匹配的提示词。

Anaconda:目前最好的Python自动补全和语法提示插件,并且提供了"跳转到定义","查找使用","显示文档","自动重命名"等
IDE 中插件的功能。Anaconda可以自己配置一些功能 Preferences-Package Setting-Anaconda-SettingUser:打开空文件复制下列代码

{
"complete_parameters": true,
"complete_all_parameters": true,
"pep8_ignore":
[
"E501"
]
}


我忽略了行字数过多的错误检查,但是自动修改格式还是会改E501的错误。

BracketHighlighter:括号、引号、标签高亮插件,支持 []、()、{}、""、'' 和 <tag></tag> 等,比 Sublime Text 自带的高亮要明显得多。设置如下:
{
"bracket_styles": {
"default": {
"icon": "dot",
// "color": "entity.name.class",
"color": "brackethighlighter.default",
"style": "highlight"
},
"unmatched": {
"icon": "question",
"color": "brackethighlighter.unmatched",
"style": "highlight"
},
"curly": {
"icon": "curly_bracket",
"color": "brackethighlighter.curly",
"style": "highlight"
},
"round": {
"icon": "round_bracket",
"color": "brackethighlighter.round",
"style": "highlight"
},
"square": {
"icon": "square_bracket",
"color": "brackethighlighter.square",
"style": "highlight"
},
"angle": {
"icon": "angle_bracket",
"color": "brackethighlighter.angle",
"style": "highlight"
},
"tag": {
"icon": "tag",
"color": "brackethighlighter.tag",
"style": "highlight"
},
"single_quote": {
"icon": "single_quote",
"color": "brackethighlighter.quote",
"style": "highlight"
},
"double_quote": {
"icon": "double_quote",
"color": "brackethighlighter.quote",
"style": "highlight"
},
"regex": {
"icon": "regex",
"color": "brackethighlighter.quote",
"style": "outline"
}
}
}
ConverToUTF8:使Sublime支持除UTF8外多种编码,防乱码

SideBarEnhancements一款很实用的右键菜单增强插件,有以 diff 形式显示未保存的修改、在文件管理器中显示该文件、复制文件路径、在侧边栏中定位该文件等功能,也有基础的诸如新建文件/目录,编辑,打开/运行,显示,在选择中/上级目录/项目中查找,剪切,复制,粘贴,重命名,删除,刷新等常见功能。

SublimeCodeIntel这是一款代码提示插件,支持多种编程语言,该插件安装时间可能相对较长,更特别的是,安装该插件后需要根据您使用的编程语言进行配置

Terminal在编程过程中,我们经常需要使用到命令行窗口,Terminal插件可以允许在Sublime Text 3中打开cmd命令窗口,安装好该插件后即可使用快捷键Ctrl+Shift+T呼出命令行窗口

Themr:主题管理插件,装好主题后通过快捷键ctrl+f5:themr_list_themes,ctrl+f7:themr_cycle_themes-prev,ctrl+f8:themr_cycle_themes-next。方便的切换主题

Colorsublime:ctrol+shift+p
换配色的东东

GittGutter:Git暖心小提示,另一篇文章写Git+sublime text

Sublime repl:让sublime里可以运行像ipython一样的东西

有警告信息的解决办法http://stackoverflow.com/questions/32719352/ipython-4-shell-does-not-work-with-sublime-repl

配置:


"repl_view_settings": {
"translate_tabs_to_spaces": true,
"auto_indent": true,
"smart_indent": true,
"spell_check": true,
"indent_subsequent_lines": true,
"detect_indentation": true,
"auto_complete": true,
"line_numbers": true,
"gutter": true
},


快捷键 preferences-->key bindings-Users

[
{"keys":["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}},
{"keys":["f4"],
"caption": "SublimeREPL: Python - IPython",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_ipython",
"file": "config/Python/Main.sublime-menu"
}}
]


AutoFileName文件路径部分的自动补全功能

最后是主题:SoDaReloaded,配色方案:Tomorrow Color Schemes-Tomorrow-Night-Bright
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: