sublime快捷键代码对齐_Python配置sublime运⾏环境
1、下载安装python和sublime,不再赘述,官⽹即可下载;
2、打开subilme,打开Tools > Build System > New Build System..
3、点击New Build System后,会⽣成⼀个空配置⽂件,在这个配置⽂件内覆盖配置信息,本⽂python安装路径为“XXXXXX”,(注意区分正反斜杠,请将路径换成python实际安装路径),然后按ctrl+s,将⽂件保存在默认路径,⽂件名命名为“Python3”
4、⽂件的修改⽅式如下:
{
"cmd": ["Python安装⽬录","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
}
5、打开Tools > Build System,选择新建好的Python3即可
6、
测试
1、新建test.py⽂件,输⼊简单python语句,按Ctrl+B运⾏
字体及字号
1、打开Preferences –>>Settings(Settings User),在右侧添加如下代码(font_face及font_size可根据个⼈喜好更改)
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"font_face": "Consolas",
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
"update_check": false,
// The number of spaces a tab is considered equal to
"tab_size": 4,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
//设置保存时⾃动转换
"expand_tabs_on_save": true
}
2、效果如下
安装Package Control
第⼀种⽅法:在线安装
通过快捷键[ctrl+`]或“View > Show Console”菜单打开控制台,将下⾯的Python代码粘贴到控制台⾥
quest,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-packa 注:上⾯代码仅适⽤于Sublime Text 3,如果是Sublime Text2请使⽤如下代码:
import urllib2,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp 关掉并重新打开Sublime Text 3,如果在Perferences->package settings中能看到package control这⼀项,则表⽰安装成功。
第⼆种⽅法:⼿动安装
1、点击 Preferences > Browse Packages… 菜单
2、Browse up a folder and then into the Installed Packages/ folder
3、Download Package Control.sublime-package and copy it into the Installed Packages/ directorypython默认安装路径
4、Restart Sublime Text
1、通过Package Control安装其他插件
1.按下Ctrl+Shift+P调出命令⾯板
2.输⼊install 调出 Install Package
3.在列表中选中要安装的插件,或者输⼊插件名,根据命令⾯板中的过滤结果,选择要安装的插件
2、通过Package Control查看已安装的插件
1. 按下Ctrl+Shift+P调出命令⾯板
2. 输⼊"package",在下拉列表到"Package Control: list packages",选中后回车,可以显⽰全部插件列表。
常⽤插件介绍及安装
SublimeCodeIntel
介绍
Full-featured code intelligence and smart autocomplete engine
Jump to Symbol Definition - Jump to the file and line of the definition of a symbol.
Imports autocomplete - Shows autocomplete with the available modules/symbols in real time.
Function Call tooltips - Displays information in the status bar about the working function.
⽀持语⾔
JavaScript, ES6, Mason, XBL, XUL, RHTML, SCSS, Python, HTML, Ruby, Python, XML, XSLT, Django, HTML5, Perl, CSS, Twig, Less, Smarty, Node.js, Tcl, TemplateToolkit, PHP.
Installation
1.Control+Shift+P打开Package Control控制台
2.输⼊install,选择关联出来的install package
3.输⼊sublimecodeintel,然后点击列表提⽰的sublimecodeintel安装
4.安装完成之后,⽂本框会出现如下显⽰,或者可以通过【Preferences>Package Settings】中查看到
已安装的sublimecodeintel插件
5.打开preferences->packages settings ->Package Control ->Settings-User,检查是否有如下红框代码,如果没有得⼿动添加
6.点击preferences中的browse Packages,进⼊SublimeCodeIntel⽂件夹,在当前的路径下新建.codeintel⽂件夹(windows中⽂件命名
的时候为 .codeintel. ),之后进⼊到 .codeintel⽂件夹中,新建⽂件“config.log”⽂件,打开输⼊(下⽂以路径“D:\Anaconda3”为
例,实际配置时请根据具体安装路径修改):
"python3":{"python":"D:/","pythonExtraPaths":["D:/Anaconda3/DLLs","D:/Anaconda3/Lib","D:/Anaconda3/Lib/lib-tk","D:/Anaconda3/Lib/site-p ]
}
如图:
7.保存,重启Sublime Text 3
测试
新建⽂件并保存为.py⽂件,输⼊代码测试
SublimeREPL
介绍
添加快捷键后,可直接运⾏当前⽂件,⾮常⽅便
Launch python in local or remote(1) virtualenv.
Quickly run selected script or launch PDB.
Use SublimeText Python console with history and multiline input.
使⽤⽅法
1、安装SublimeREPL插件后,打开Preferences->Key Bindings,添加快捷键:
代码粘贴:
[
{"keys": ["f5"],"caption": "SublimeREPL: Python - RUN current file","command": "run_existing_window_command","args": {"id": "repl_python_run","file": "config/P }
}
]
测试
1、新建test.py⽂件,例如:
2、上⽂中SublimeREPL插件设置的快捷键是F5,所以按F5运⾏成功如下
SublimeTmpl
介绍
安装插件后,可以通过快捷键按照模板快速新建⽂件
使⽤⽅法
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论