安装sublime_text_3
wget -c http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3083_x64.tar.bz2 # sublime3的下载地址是这里 http://www.sublimetext.com/3 tar jxvf sublime_text_3_build_3083_x64.tar.bz2 -C /opt cd /opt/sublime_text_3/ ./sublime_text # 启动程序查看效果 ln -s /opt/sublime_text_3/sublime_text /usr/local/bin/sublime # 软链接到系统path中 cp /opt/sublime_text_3/sublime_text.desktop /usr/share/applications # 复制桌面支持到系统应用目录下 cd /usr/share/applications/ vim sublime_text.desktop # change Icon=/opt/sublime_text_3/Icon/48x48/sublime-text.png and Exec=/opt/sublime_text_3/sublime_text %F # 使得sublime的图标可显示
安装Package Control,按官方提供方法安装:https://packagecontrol.io/installation
安装了以下插件:
1.主题插件:http://jamiewilson.io/predawn/ 安装Predawn主题,完成后会打开他的messages文档信息,把里面的配置放入preferences->Settings-User配置中边栏变成黑色的
2.侧边栏插件:SideBarEnhancements 是一款很实用的右键菜单增强插件
3.python的插件:anaconda,不知道好不好用
点击 Tools > Build System > New Build System...
将打开的文件名命名为Python3.sublime-build
编辑文件内容为(让sublime text自动选择python语法):
{
"cmd": ["/path/to/python3", "-u", "$file"],
"file_regex": "^[ ]*File "(...*?)", line ([0-9]*)",
"selector": "source.python"
}
Pylinter.sublime-settings 配置了pylinter 插件。我使用下面的配置让 Pyhton 在保存时自动规范,并对违反规范显示图标。 { // Configure pylint's behavior "pylint_rc": "/Users/daniel/dev/pylintrc", // Show different icons for errors, warnings, etc. "use_icons": true, // Automatically run Pylinter when saving a Python document "run_on_save": true, // Don't hide pylint messages when moving the cursor "message_stay": true } SublimeCodeIntel 插件,智能提示插件,这个插件的智能提示功能非常强大,可以自定义提示的内容库,我的Python智能提示设置 { "Python": { "python":"D:/Python27/python.exe", "pythonExtraPaths": [ "D:/Python27", "D:/Python27/DLLs", "D:/Python27/Lib", "D:/Python27/Lib/lib-tk", "D:/Python27/Lib/site-packages" ] }
"PHP": {
"php": "E:/wamp/bin/php/php5.4.12/php.exe",
"phpExtraPaths": "d:/Yii",
"phpConfigFile": "E:/wamp/bin/php/php5.4.12/php.ini"
}
}
Python PEP8 Autoformat 插件
这是用来按PEP8自动格式化代码的。可以在包管理器中安装。快捷键 CTRL+SHIFT+R 自动格式化python代码
pylinter配置:
{ // Configure pylint's behavior "pylint_rc": "C:/Users/zhanglei/AppData/Roaming/Sublime Text 3/Packages/Pylinter", "pylint_path": "C:/Python34/Lib/site-packages/pylint", // Show different icons for errors, warnings, etc. "use_icons": true, // Automatically run Pylinter when saving a Python document "run_on_save": true, // Don't hide pylint messages when moving the cursor "message_stay": true }
4.golang的插件:GoSublime(好像也不想要下面的配置),godef导入的库提示,goimports
{ "env": { "GOBIN":"/opt/golang/go/bin", "GOROOT":"/opt/golang/go", "GOPATH": "/opt/golang/gopath" } }
5.css3的插件:CSS3
ColorPicker 调色盘,Alignment 等号对齐按Ctrl+Alt+A,BracketHighlighter 高亮显示匹配的括号、引号和标签(需要时可以使用)
下面是我的一个配置preferences->Settings-User内容:
添加 "auto_complete_selector": "source, text"来自动补全代码
{ "caret_style": "solid", "color_scheme": "Packages/Predawn/predawn.tmTheme", "find_selected_text": true, "font_size": 11.0, "highlight_line": true, "highlight_modified_tabs": true, "ignored_packages": [ "Vintage" ], "line_padding_bottom": 0, "line_padding_top": 0, "scroll_past_end": false, "show_minimap": false, "sidebar_default": true, "tab_size": 4, "theme": "predawn.sublime-theme", "translate_tabs_to_spaces": true, "trim_trailing_white_space_on_save": true, "wide_caret": true, "word_wrap": true, "auto_complete_selector": "source, text" }
6.ctags,这个插件能跨文件跳转,跳转到指定函数声明的地方。 使用package control 搜索ctags 进行安装(安装ctags插件就可以了, 还有一个 CTags for PHP 插件没什么用)。注意安装好插件后要需要安装ctags命令。window 下载 ctags.exe http://ctags.sourceforge.net/。
编辑ctags的settings - User,添加如下内容:
{ "command": "C:/Python34/ctags58/ctags.exe" }
(或将ctags.exe文件放在一个环境变量能访问到的地方,打开cmd, 输入ctags,如果有这个命令,证明成功)
ubuntu下安装运行命令:sudo apt-get install ctags 。
然后在sublime项目文件夹右键, 会出现Ctag:Rebuild Tags 的菜单,然后会在项目中生成.tags的文件。
7.运行php文件Tools->Build System->New Build System...,添加以下内容,保存
{ "cmd": ["E:/wamp/bin/php/php5.4.12/php.exe", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "path": "E:/wamp/bin/php/php5.4.12", "selector": "source.php" }
总结:
python插件需要:SublimeCodeIntel+anaconda+pylinter+?(Python PEP8 Autoformat),感觉开发python已经很nice了,也可以加上ctags
php插件需要:SublimeCodeIntel+ctags,一般情况也足够应付了(就是跟踪提示差些)