sublime笔记

来源:互联网 发布:远程会诊软件 编辑:程序博客网 时间:2024/06/05 19:11

  • 插件安装和使用

首先,要安装package control,按照官方方法安装:

https://packagecontrol.io/installation

重启Sublime Text 3。

如果在Perferences->package settings中看到package control这一项,则安装成功。

然后,调出package control,选择安装插件,搜索需要的插件,点击安装


重要插件的安装和使用:

1.sublime安装HTML-CSS-JS Prettify插件用于格式化html,需要先安装nodejs(默认安装目录:/usr/local/bin/node):https://nodejs.org/en/download/,快捷键:command+shift+h

2.Theme - Soda主题插件:安装Theme - Soda插件,Preferences -> Settings - User,加入一句:"theme": "Soda Light 3.sublime-theme" 或 "theme": "Soda Dark 3.sublime-theme"
具体文档:https://packagecontrol.io/packages/Theme%20-%20Soda
可以结合安装colour-schemes高亮颜色主题:
http://buymeasoda.github.com/soda-theme/extras/colour-schemes.zip
Preferences->Browse Packages,把解压后的两个文件放入user目录
选择:Preferences -> Color Scheme -> User下的两个主题中的一个

3.Emmet插件(快速编写html和css)使用:

安装完插件后,使用ctrl+alt+enter呼出命令子窗口,在子窗口输入缩写命令,主窗口显示结果
或先设置文档为html格式,然后直接写缩写命令,写完加tab键执行

4.jsformat:设置文档格式为javascript->json,快捷键ctrl+alt+f

6.SublimeCodeIntel:js,php等代码的自动补全

7.html,css,js代码语法检测插件:

  安装SublimeLinter插件(必须先装nodejs)

  html语法检测安装sublimeLinter-contrib-htmlhint插件(sublime搜索安装插件),再安装htmlhint,htmlhint使用nodejs下的npm工具安装:

  npm install -g htmlhint@latest,安装完成后,点击右键,SublimeLinter菜单里有很多设置,比如可以设置保存时提示语法错误

 安装jshint和csslint,用于检测js和css语法,在sublime插件里搜索SublimeLinter-csslint 和SublimeLinter-jshint安装,再执行npm命令:

  npm install -g jshint@latest

  npm install-g csslint@latest

 特别注意,ccs是lint,其他两个是hint

  最后,选择prefrences->package setting->SublimeLinter->setting user,使用以下内容覆盖:

  {
    "user": {
        "csslint_options": {
            "adjoining-classes": false,
            "box-model": false,
            "box-sizing": false,
            "compatible-vendor-prefixes": false,
            "floats": false,
            "font-sizes": false,
            "gradients": false,
            "important": false,
            "known-properties": false,
            "outline-none": false,
            "qualified-headings": false,
            "regex-selectors": false,
            "shorthand": false,
            "text-indent": false,
            "unique-headings": false,
            "universal-selector": false,
            "unqualified-attributes": false
        },
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "jshint_options": {
            "browser": true,
            "curly": true,
            "devel": true,
            "eqeqeq": true,
            "evil": true,
            "forin": true,
            "globals": {
                "$": true,
                "console": true,
                "document": true,
                "global": true,
                "grunt": true,
                "jQuery": true,
                "module": true,
                "setInterval": true,
                "setTimeout": true,
                "window": true
            },
            "jquery": true,
            "latedef": true,
            "noarg": true,
            "noempty": true,
            "quotmark": "single",
            "strict": false,
            "undef": true,
            "unused": "vars",
            "wsh": true
        },
        "lint_mode": "background",
        "linters": {
            "csslint": {
                "@disable": false,
               
"args": ["--ignore=order-alphabetical,ids,box-model,font-sizes"],//去除ccs属性按字母排序的检测
                "errors": "",
                "excludes": [],
                "ignore": "",
                "warnings": ""
            },
            "htmlhint": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "jshint": {
                "@disable": false,
                "args": [],
                "excludes": []
            }
        },
        "mark_style": "outline",
        "no_column_highlights_line": false,
        "passive_warnings": false,
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": true,
        "show_marks_in_minimap": true,
        "sublimelinter": "save-only",
        "sublimelinter_executable_map": {
            "css": "/usr/local/bin/node",
            "javascript": "/usr/local/bin/node"
        },
        "sublimelinter_popup_errors_on_save": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "javascript (babel)": "javascript",
            "magicpython": "python",
            "php": "html",
            "python django": "python",
            "pythonimproved": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}



  • sublime设置文档格式

shift + command + p呼出面板,输入set+文档格式首字母,比如html,输入seth,java输入setj,选择对应的格式即可

0 0
原创粉丝点击