#####导语:
Sublime Text:一款具有代码高亮、语法提示、自动完成且反应快速的编辑器软件。不仅具有华丽的界面,还支持插件扩展机制,用她来写代码,绝对是一种享受。相比于难于上手的 Vim,浮肿沉重的 Eclipse,PHPStorm,即便体积轻巧迅速启动的 Editplus、Notepad++,在 SublimeText 面前略显失色,无疑这款性感无比的编辑器是 Coding 和 Writing 最佳的选择。
1.去中文网 使用中文镜像
2.安装 chinese语言包
3.colorsublime theme
```重度使用 看下
第一步、Package Control#
Package Control 是管理插件的插件。通过 View->Show Console 菜单打开命令行,黏贴以下代码进行安装:
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; 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)
如何使用中
`设置里面加 { "channels": [ "http://packagecontrol.cn/channel_v3.json" ] }`
我的首选项的用户设置为
```json
{
"auto_find_in_selection": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Colorsublime-Themes/themes/BrogrammerMY.tmTheme",
"dpi_scale": 1.0,
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"font_size": 13,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": 3,
"line_padding_top": 3,
"mdpopups.default_formatting": false,
"open_files_in_new_window": false,
"original_color_scheme": "Packages/Colorsublime-Themes/themes/BetterJS-Dark.tmTheme",
"tab_size": 4,
"theme": "SoDaReloaded Dark.sublime-theme",
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"update_check": false,
"word_separators": "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?",
"word_wrap": "auto"
}
//我绑定过的按键
[
{ "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true} },
{ "keys": ["alt+j"], "command": "move", "args": {"by": "characters", "forward": false} },
{ "keys": ["alt+k"], "command": "move", "args": {"by": "lines", "forward": true} },
{ "keys": ["alt+i"], "command": "move", "args": {"by": "lines", "forward": false} },
{ "keys": ["f5"], "command": "side_bar_files_open_with", "args": { "paths": [], "application": "C:/Users/asus/AppData/Local/Google/Chrome/Application/chrome.exe", "extensions": ".*" } },
{ "keys": ["ctrl+`"], "command": "open_terminal" },
{ "keys": ["ctrl+j"], "command": "code_intel_auto_complete" },
{ "keys": ["ctrl+f3"], "command": "goto_python_definition" },
{ "keys": ["ctrl+shift+u"], "command": "find_use" },
{ "keys": ["ctrl+shift+n"], "command": "import_namespace" },
]
1.第一个插件是Docblockr 函数的自动注释 及其基本配置使用(首选项-用户配置)
{
"jsdocs_extra_tags":[
"@param {string}",
"@DateTime {{date}}",
],
"jsdocs_function_description": true
}
File Header 文件的开头注释 `` {
"Default": {
"author":"rainbow",
"last_modified_by":"rainbow"
} } ``
代码片段如何制作 顶部导航栏 Tools -> Developer -> New Snippet , 将下面的代码复制粘贴并保存为acm就可以了,中间部分可以更改为自己的模板
``
</content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>phpcon(快捷键)</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
``
2、SublimeLinter | 代码检测 SublimeLinter-PHP | PHP 代码实时报错检测 代码错误自检 鼠标放在错误提示的红点可以在下面看错误 及其基本配置使用(首选项-用户配置)
// SublimeLinter Settings - User
{
"debug": false,
"paths": {
"linux": [],
"osx": [],
"windows": [
"D:/phpStudy/PHPTutorial/php/php-5.6.27-nts"
]
},
"styles": [
{
"scope": "region.purplish markup.warning.sublime_linter",
},
{
"icon": "circle",
"mark_style": "outline",
}
],
}
另js 方面的检测 eslint https://www.php.cn/tool/sublime/431732.html
另 编辑器tools->build system 里面加一个通过"php -l"来实现的检测功能
3.html代码书写插件Emmet(比如按tab)还有其他大部分好用功能 同时也需安装PyV8 https://github.com/emmetio/pyv8-binaries 另附pyv8win版本下载地址 https://code.google.com/archive/p/pyv8/downloads
4.cndict 翻译 非必选
5.ConvertToUTF8 //转编码的 也可以用 EditorConfig
6.Colorsublime-Themes想要改配色个人必选 如果想改变内置规则 可以打开目录 直接修改对应的文件 比如background 在xml文件里面直接改变即可变色 推荐关键词 facebook Material Themel | 非常棒的编辑器主题,注意作者是 equinusocio
7.SublimeCodeIntel 代码智能提示 必须 及其首选项-用户的配置
{
"JavaScript": {
"codeintel_selected_catalogs": ["JavaScript"]
},
"PHP": {
"php": "D:/phpstudy/PHPTutorial/php/php-5.6.27-nts",/*我的PHP安装路径*/
"codeintel_scan_extra_dir": [],
"codeintel_scan_files_in_project": true,
"codeintel_max_recursive_dir_depth": 15,
"codeintel_scan_exclude_dir":["E:/MYWEBLIST/thinkphp_5.0.20_with_ext"] /*我的WEB项目路径*/
}
}
8.xdebug 及其首选项 - 用户的配置
{
// Example:
// "/absolute/path/to/file/on/server" : "/path/to/file/on/computer",
// "/var/www/htdocs/example/" : "C:/git/websites/example/"
"path_mapping": {
// "/www": "D:/xxx/xxx"
},
"ide_key": "sublime.xdebug",//也可以自己随便设置
"host": "127.0.0.1",
"url" : "abc.cn",
"port": 9999,
"debug": true
}
9.side bar 左边文件菜单栏扩展 增加了文件新增 copy patse等常用功能 SideBarEnhancements | 文件夹栏右键菜单增强
10.Terminal 安装后并调用cmder
{ // window下终端路径 “terminal”: “C:\MyAPP\cmder\Cmder.exe”, // window下终端参数 “parameters”: ["/START", “%CWD%”] }
11.php companion 推荐 Find use 命名空间 接口函数 的自动实现
12.BrackerHighlighter 推荐 括号成对高亮提示
laravel 必装
Laravel 5 Snippets | 代码片段 主页 F12可追踪
laravel 可选
Laravel 5 Artisan | Artisan 命令行调用 主页
Laravel Blade Hightlighter | Blade 语法高亮支持
13.CodeFormatter php及其js python的代码格式化 需配置php_path 路径
14.AdvancedNewFile 新建文件多层次
15.SyncedSideBar | 自动在左边文件夹树中定位当前文件 蛮实用的这个
16.Findkeyconfilcts 查找快捷键绑定冲突
其他可选插件# chese..loc 中文汉化
Blade Snippets | Blade 模板自动补全
ALignment | command + control + a 快速对齐 示例
BracketHighlighter | 结尾处高亮 主页
EditorConfig | .editorconfig 编码格式化支持
SCSS | 官方版本语法高亮
AdvancedNewFile | 快速创建新文件 主页
GitGutter | 分析代码修改差异并显示 主页
结语# 安装插件时要特别慎重,编辑器的速度很重要。
我的编辑器实用快捷键汇总
首先F12 很重要的功能
ctrl+d 选中一个词 //很常用
ctrl+l 选择整行继续按继续选择
Ctrl+M 光标移动至括号内开始或结束
ctrl+shift+d 选中一行
Ctrl+Shift+K 删除整行
ctrl+shift+v 粘贴并保持缩进
ctrl+shift+↑ 或 ↓ 代码上下移
Ctrl+鼠标左键 不怎么用鼠标党 看情况用
Alt+Shift+1,2,3 分几个屏 我经常用2个
Ctrl+Shift+1,2,3 焦点分配到分屏序号页
ctrl+shift+y 计算数学表达式
Shift+Tab 去除缩进
Ctrl+F2 设置/取消书签 想要快速往返2个代码常用
F2 跳到下一个书签
shift+F2 跳到上一个书签
ctrl+/ 注释行
ctrl+shift+/ 多行注释
光标的4个方向移动 打开文件在浏览器 打开命令行插件terminal
ctrl+r 查看当前文件的所有方法并快速定位 html是查看所有ID
ctrl+p 跳转到文件
ctrl+h 当前文件替换
ctrl+shift+f 搜索文件夹并替换
ctrl+g 跳到第几行
f3 查看变量相关
插件sublimecodeintel 快捷键绑定
ctrl+j 代码补全 比如加;
ctrl+f3 跳转到变量定义处
ctrl+i 操作历史记录并跳转
PHP Companion插件的快捷键
ctrl+shift+u 自动find_use
ctrl+shift+n 自动写入namespace
自动导入use 和 namespace 覆盖了原来的软重做 和 新建sublime窗口
FindKeyConflicts的使用
ctrl+shift+p打开命令面板 输入
FindKeyConflicts: All Key Maps to Quick Panel
查询所有快捷键
FindKeyConflicts: (Direct) Conflicts to Quick Panel
查询所有冲突按键
AdvancedNewFile插件相关 新建文件多层次
ctrl+alt+n 新建路径下的文件 支持tab补全路径
用法例
project:(按tab自动补全)/(按tab自动补全文件夹)
codeformatter插件相关(格式化php代码 未使用use 自动删除等功能)
需要插件配置php路径
codeformatter_php_options 的 php_path
并且 php5.6+
ctrl+alt+f 格式化代码
其他冲突及其坑爹的快捷键:
注释自带的快捷键
F9
ctrl+f9
ctrl+y
ctrl+w
ctrl+shift+w
//其他sublime自带
https://www.jianshu.com/p/1d642c9f204c
插件配置
{
// Example:
// "/absolute/path/to/file/on/server" : "/path/to/file/on/computer",
// "/var/www/htdocs/example/" : "C:/git/websites/example/"
"path_mapping": {
},
"max_depth": 2,
"url": "http://z.cn",
"ide_key": "sublime.xdebug",
"host": "",
"port": 9999,
"debug": true
}
首先配置必须在url后面加?XDEBUG_SESSION_START=key 注意插件内部也要配置key
原来的快捷键
Ctrl+f8: 打断点
Shift+f8: 打断点条件模式
ctrl+shift+f9 xdebug_session_start
ctrl+shift+10 xdebug_session_stop
ctrl+shift+11 xdebug_layout
Ctrl+Shift+f5: 运行到下一个断点
Ctrl+Shift+f6: 单步
Ctrl+Shift+f7: 步入
Ctrl+Shift+f8: 步出
修改后的快捷键
f8 打断点
shift+f8 不变
ctrl+f9 xdebug_session_start
ctrl+10 xdebug_session_stop
ctrl+11 xdebug_layout
Ctrl+f5: 运行到下一个断点
f6: 单步
f7: 步入
Ctrl+f8: 步出
另外微信小程序如何断点 :打开soruces 鼠标双击左侧打断点 F10单步 F8退出
//我绑定过的按键
{ "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true} },
{ "keys": ["alt+j"], "command": "move", "args": {"by": "characters", "forward": false} },
{ "keys": ["alt+k"], "command": "move", "args": {"by": "lines", "forward": true} },
{ "keys": ["alt+i"], "command": "move", "args": {"by": "lines", "forward": false} },
{ "keys": ["f5"], "command": "side_bar_files_open_with", "args": { "paths": [], "application": "C:/Users/asus/AppData/Local/Google/Chrome/Application/chrome.exe", "extensions": ".*" } },
{ "keys": ["ctrl+`"], "command": "open_terminal" },
{ "keys": ["ctrl+j"], "command": "code_intel_auto_complete" },
{ "keys": ["ctrl+f3"], "command": "goto_python_definition" },
{ "keys": ["ctrl+shift+u"], "command": "find_use" },
{ "keys": ["ctrl+shift+n"], "command": "import_namespace" },
{"keys": ["f8"], "command": "xdebug_breakpoint"},
{"keys": ["ctrl+f5"], "command": "xdebug_continue", "args": {"command": "run"}},
{"keys": ["f6"], "command": "xdebug_continue", "args": {"command": "step_over"}},
{"keys": ["f7"], "command": "xdebug_continue", "args": {"command": "step_into"}},
{"keys": ["ctrl+f8"], "command": "xdebug_continue", "args": {"command": "step_out"}},
{"keys": ["ctrl+f9"], "command": "xdebug_session_start"},
{"keys": ["ctrl+f10"], "command": "xdebug_session_stop"},
{"keys": ["ctrl+f11"], "command": "xdebug_layout", "args": {"keymap" : true}},
推荐一个主流常用ide 插件配置的网站 https://curder.gitbooks.io/blog/tools/
本文转载无需和我联系,但请注明来自记录你我https://recwe.com
最新评论