最近学习python,看网上推荐用sublime text2挺方便,就学习了一下对sublime text2 安装插件,先放在这里,以备以后查找
根据晚上资料修改,原文请看这里
Python的自动补全插件推荐 JEDI, 写好之后可以直接按 Ctrl + B 解释执行.
1.安装Package Control (详细请点击)
# ctrl+`
# Sublime Text 2
import urllib2,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
# Sublime Text3
import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; 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)
2. Install Package
#Ctrl+Shift+P =>Install Package =>JEDI
3.直接在配置文件中进行修改,sublime 会自动安装
#Package setting => Package Contral => setting-user { "in_process_packages": [ ], "installed_packages": [ "Alignment", "BracketHighlighter", "DocBlockr", "Emmet", "FileDiffs", "GBK Encoding Support", "Jedi - Python autocompletion", "jQuery", "JsFormat", "LESS", "Markdown Extended", "Package Control","Trimmer" ] }
sublime text2 编译执行perl (Ctrl + B)
# Tool -> Build System -> New Build System # 保存文件名: Perl.sublime-build # 内容如下 { "cmd": ["perl", "-w", "$file"], "file_regex": ".* at (.*) line ([0-9]*)", "selector": "source.perl" }
sublime text3 编译执行lua(版本选好, build system选好)
{ "cmd": ["lua", "$file"], "file_regex": "^(?:lua:)?[ ](...*?):([0-9]*):?([0-9]*)", "selector": "source.lua" }
sublime text2 配置Golang环境
安装好Sublime Package Control 后进入 Package Control: Install Package
安装以下插件:
GoSublime 代码提示
SidebarEnhancements 打开左边的浏览器, 一般是自带的, 可以不必安装.
GoBuild 重启后看看有没有高亮和自动提示, 如果没有, 检查$PATH是否配置正确, 可以打开终端输入 gocode ,如果不能正常运行就表示没有正确.
SublimeREPL sublime text 2 的内置命令不支持调试过程中输入参数, 这个插件可以.