Sublime Text 3 的一些个人配置

来源:互联网 发布:淘宝粤通卡车宝是什么 编辑:程序博客网 时间:2024/05/19 16:36

本来用的IDE,后来觉得笨重,打代码不顺手。换了Sublime Text 3,加了一些插件,个性化后觉得可以。记录下。

经常要在html/css/javascript/php中做切换。

css属性兼容,用了Autoprefixer,用户配置:
{
“browsers”: [“last 2 versions”,”10%”,”IE 8”],
“cascade”: true,
“remove”: true,
“prefixOnSave”: true
}
浏览器可以自行选择:
- 主流浏览器最近2个版本用“last 2 versions”;
- 全球统计有超过10%的使用率使用“>10%”;
- 仅新版本用“ff>20”或”ff>=20”.
“prefixOnSave”属性默认为 false,改为true。这样可以同时修改同个css属性的若干个兼容。
用户按键中设定了:
//自动添加css前缀
{
“keys”: [“alt+2”],
“command”: “autoprefixer”
},
举例:body{display:flex;},然后alt+2,自动补全。
嗨呀,手短的孩子伤不起。

DocBlockr:自动补全函数注释。
在一个function前输入/**,然后enter或者table键。自动补全了注释,可以添加函数说明。

HTML-CSS-JS Prettify:格式化这三种代码。
shortkey:
{
“keys”: [“ctrl+shift+x”],
“command”: “htmlprettify”
},
效果可以;

Sidebar Enhancements:侧边栏增强
用户配置:
{
“statusbar_modified_time”: false,
“statusbar_modified_time_format”: “%A %b %d %H:%M:%S %Y”,
“statusbar_modified_time_locale”: “”,

"statusbar_file_size": false,"close_affected_buffers_when_deleting_even_if_dirty": false,"hide_open_with_entries_when_there_are_no_applicable": false,"confirm_before_deleting": true,"confirm_before_permanently_deleting": true,"new_files_relative_to_project_root": false,"new_folders_relative_to_project_root": false,"disabled_menuitem_edit": false,"disabled_menuitem_edit_to_right": false,"disabled_menuitem_open_run": false,"disabled_menuitem_open_in_browser": false,"disabled_menuitem_open_in_new_window": false,"disabled_menuitem_find_in_project": false,"disabled_menuitem_copy_name": false,"disabled_menuitem_copy_path": false,"disabled_menuitem_copy_path_windows": true,"disabled_menuitem_copy_dir_path": true,"disabled_menuitem_paste_in_parent": false,"disabled_menuitem_empty": true,//if installed in a default location maybe this works."default_browser": "chrome", //one of this list: firefox, chrome, canary, chromium, opera, safari, ie"open_all_browsers": ["firefox", "chrome", "opera", "safari", "ie", "edge"], //any of this list: firefox, chrome, canary, chromium, opera, safari, ie, edge"portable_browser": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", // for example:  C:/Program Files (x86)/Nightly/firefox.exe"disable_send_to_trash": false,"use_powershell": true,"auto_close_empty_groups": false

}
主要是更改浏览器位置。
为了在localhost上调试php,设置了一个快捷打开浏览器的功能,如下:
shortcut:
//php运行在localhost中
{
“keys”: [“alt+r”],
“command”: “side_bar_open_in_browser”,
“args”: {
“paths”: [],
“type”: “testing”,
“browser”: “”
}
},
这样可以把html与php分开运行在同一个浏览器上,只需要在wamp的www文件夹下打开.php即可。

Emmet:嗨呀你懂的,前端们
默认配置即可。

View In Browser:我的作用是运行html。
用户配置:
{
“posix”: {
“linux”: {
“firefox”: “firefox -new-tab”,
“chrome”: “google-chrome”,
“chrome64”: “google-chrome”,
“chromium”: “chromium”
},
“linux2”: {
“firefox”: “firefox -new-tab”,
“chrome”: “google-chrome”,
“chrome64”: “google-chrome”,
“chromium”: “chromium”
},
“darwin”: {
“firefox”: “open -a \”/Applications/Firefox.app\”“,
“safari”: “open -a \”/Applications/Safari.app\”“,
“chrome”: “open -a \”/Applications/Google Chrome.app\”“,
“chrome64”: “open -a \”/Applications/Google Chrome.app\”“,
“yandex”: “open -a \”/Applications/Yandex.app\””
}
},
“nt”: {
“win32”: {
“firefox”: “C:\Program Files (x86)\Mozilla Firefox\firefox.exe -new-tab”,
“iexplore”: “C:\Program Files\Internet Explorer\iexplore.exe”,
“chrome”: “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -new-tab”,
“chrome64”: “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”,
“yandex”: “%Local AppData%\Yandex\YandexBrowser\browser.exe”
}
},

"browser": "chrome"

}
改改浏览器位置,
shortcut:
//html运行在浏览器中
{ “keys”: [ “alt+3” ], “command”: “view_in_browser” , “args”: { “browser”: “chrome” }},
手短,摸摸大!

还有一些其他的php代码自动补全的插件,这些很多种类,不多说了。

比较可惜的是兼容Sublime Text 3 的php代码格式化插件很少,弄了很久的phpcbf没有成功。烦心。

鼠标选中多行,按下 Ctrl Shift L (Command Shift L) 即可同时编辑这些行;
鼠标选中文本,反复按 CTRL D (Command D) 即可继续向下同时选中下一个相同的文本进行同时编辑;
鼠标选中文本,按下 Alt F3 (Win) 或 Ctrl Command G(Mac) 即可一次性选择全部的相同文本进行同时编辑;
Shift 鼠标右键 (Win) 或 Option 鼠标左键 (Mac) 或使用鼠标中键可以用鼠标进行竖向多行选择;
Ctrl 鼠标左键(Win) 或 Command 鼠标左键(Mac) 可以手动选择同时要编辑的多处文本

0 0
原创粉丝点击