1. 安装package control

https://packagecontrol.io/installation

下载地址:
https://packagecontrol.io/Package%20Control.sublime-package

添加channel文件:
http://static.bolin.site/channel_v3.json

2. 常用插件

2.1 通用插件

SideBarEnhancements插件

  • 使用截图:
    SublimeText使用 - 图1

AutoFileName

Terminus插件

  • 快捷键:
  1. [
  2. {
  3. "keys": ["ctrl*shift*t"],
  4. "command": "toggle_terminus_panel"
  5. }
  6. ]
  • 使用截图:

SublimeText使用 - 图2

TrailingSpaces插件

BracketHighlighter

2.2 HTML插件

Emmet

Tag插件

SublimeCodeIntel插件

LiveReload插件

HTML-CSS-JS Prettify插件

2.3 JS插件

JsFormat插件

Alignment

Babel

  1. 使用时需要将所有js后缀文件设置语法为Babel
  • 使用截图:
    SublimeText使用 - 图3

DocBlockr

  • 使用截图:
    SublimeText使用 - 图4

HyperClick

  • 使用截图:
    SublimeText使用 - 图5

jsfmt

  • 设置:
  1. {
  2. // autoformat on save
  3. "autoformat": false,
  4. // array of extensions for autoformat
  5. "extensions": ["js", "jsx", "sublime-settings", "sublime-keymap"],
  6. // options for jsfmt
  7. "options": {
  8. "preset": "jquery",
  9. "indent": {
  10. "value": " "
  11. },
  12. // plugins included
  13. "plugins": [
  14. "esformatter-jsx",
  15. // "esformatter-quotes",
  16. // "esformatter-semicolons",
  17. // "esformatter-braces",
  18. // "esformatter-dot-notation"
  19. ],
  20. // plugins included
  21. "jsx": {
  22. "formatJSX": true, //Duh! that's the default
  23. "attrsOnSameLineAsTag": false, // move each attribute to its own line
  24. "maxAttrsOnTag": 3, // if lower or equal than 3 attributes, they will be kept on a single line
  25. "firstAttributeOnSameLine": true, // keep the first attribute in the same line as the tag
  26. "formatJSXExpressions": true, // default true, if false jsxExpressions won't be recursively formatted
  27. "JSXExpressionsSingleLine": true, // default true, if false the JSXExpressions might span several lines
  28. "alignWithFirstAttribute": false, // do not align attributes with the first tag
  29. "spaceInJSXExpressionContainers": " ", // default to one space. Make it empty if you don't like spaces between JSXExpressionContainers
  30. "removeSpaceBeforeClosingJSX": false, // default false. if true <React.Something /> => <React.Something/>
  31. "closingTagOnNewLine": false, // default false. if true attributes on multiple lines will close the tag on a new line
  32. "JSXAttributeQuotes": "", // possible values "single" or "double". Leave it as empty string if you don't want to modify the attributes' quotes
  33. "htmlOptions": {
  34. "brace_style": "collapse",
  35. "indent_size": 4,
  36. "indent_char": " ",
  37. "indent_with_tabs": false,
  38. "max_preserve_newlines": 2,
  39. "preserve_newlines": true
  40. // put here the options for js-beautify.html
  41. }
  42. }
  43. },
  44. "options-JSON": {
  45. "plugins": [
  46. "esformatter-quotes"
  47. ],
  48. "quotes": {
  49. "type": "double"
  50. }
  51. },
  52. "alert-errors": true,
  53. // path to nodejs
  54. "node-path": "node",
  55. // if true it will format the whole file even if you have a selection active
  56. "ignore-selection": false
  57. }
  • 快捷键
  1. {
  2. "keys": [
  3. "ctrl*q"
  4. ],
  5. "command": "format_javascript"
  6. }
  • 使用截图:
    SublimeText使用 - 图6

2.4 CSS插件

ColorHighlight

  • 使用截图:
    SublimeText使用 - 图7

CssComb插件

Autoprefixer插件

2.2 Markdown插件

MarkdownEditting

  • 使用截图:
    SublimeText使用 - 图8

MarkdownPreview

  • 设置:
  1. {
  2. "browser": "/Applications/Google Chrome.app",
  3. "enable_autoreload": true
  4. }
  • 快捷键:
  1. [
  2. {
  3. "keys": ["alt*m"],
  4. "command": "markdown_preview",
  5. "args": {"target": "browser", "parser":"markdown"}
  6. }
  7. ]
  • 使用截图:

SublimeText使用 - 图9

3. 使用技巧

3.1 文本排序&查找重复行&删除重复行


    1. 排序

按F9或者选择菜单:Edit > Sort Lines,对每行文本进行排序


    1. 查找重复行

排序好后,按Ctrl+F,调出查找面板


    1. 查找字符串:
  1. ^(.+)$[\r\n](^\1$[\r\n]{0, 1})+

注意:确保正则模式开关打开;若不可用,按Alt+R进行切换
点击Find


    1. 删除重复行

排序好后,按Ctrl+H,调出替换面板
查找字符串:

  1. ^(.+)$[\r\n](^\1$[\r\n]{0, 1})+

注意:确保正则模式开关打开;若不可用,按Alt+R进行切换

替换字符串:

  1. \1\n

点击Replace

参考链接