sublime笔记
Posted 手指乐
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sublime笔记相关的知识,希望对你有一定的参考价值。
- 插件安装和使用
首先,要安装package control,按照官方方法安装:
https://packagecontrol.io/installation
重启Sublime Text 3。
如果在Perferences->package settings中看到package control这一项,则安装成功。
然后,调出package control,选择安装插件,搜索需要的插件,点击安装
sublime调出命令行控制面板:shift + command + p,所有功能都可以在这个面板中控制
重要插件的安装和使用:
1.sublime安装html-CSS-JS Prettify插件用于格式化html,需要先安装nodejs(默认安装目录:/usr/local/bin/node,一般默认安装):https://nodejs.org/en/download/,
格式化快捷键:command+shift+h
2.设置theme:(除编辑区以外的sublime风格)
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
设置color scheme:(编辑区的背景颜色、文字颜色)
可以结合安装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键执行
6.SublimeCodeIntel:js,php等代码的自动补全
js代码自动补全配置:
通过路径Perferences->Package Settings->SublimeCodeIntel->Setting - Defalut打开配置文件,找到如下配置项:
"codeintel_language_settings": {
"Python3": {
"python3": "/usr/local/bin/python3.3",
"codeintel_scan_extra_dir": [
"/Applications/Sublime Text.app/Contents/MacOS",
"~/Library/Application Support/Sublime Text 3/Packages/SublimeCodeIntel/arch",
"~/Library/Application Support/Sublime Text 3/Packages/SublimeCodeIntel/libs"
],
"codeintel_scan_files_in_project": true,
"codeintel_selected_catalogs": []
},
"javascript": {
"codeintel_scan_extra_dir": [],
"codeintel_scan_exclude_dir":["/build/", "/min/"],
"codeintel_scan_files_in_project": false,
"codeintel_max_recursive_dir_depth": 2,
"codeintel_selected_catalogs": ["jQuery"]
},
"PHP": {
"php": "/Applications/MAMP/bin/php/php5.5.3/bin/php",
"codeintel_scan_extra_dir": [],
"codeintel_scan_files_in_project": true,
"codeintel_max_recursive_dir_depth": 15,
"codeintel_scan_exclude_dir":["/Applications/MAMP/bin/php/php5.5.3/"]
}
}
找到"JavaScript"代码段,将
"codeintel_selected_catalogs": ["jQuery"]
改为:
"codeintel_selected_catalogs": ["JavaScript"]
保存。
重启sublime
7.html,css,js代码语法检测插件:
安装SublimeLinter插件(必须先装nodejs)
html语法检测安装sublimeLinter-contrib-htmlhint插件(sublime搜索安装插件),再安装htmlhint,htmlhint使用nodejs下的npm工具安装:
npm install -g [email protected],安装完成后,点击右键,SublimeLinter菜单里有很多设置,比如可以设置保存时提示语法错误
安装jshint和csslint,用于检测js和css语法,在sublime插件里搜索SublimeLinter-csslint 和SublimeLinter-jshint安装,再执行npm命令:
npm install -g [email protected]
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
}
}
passive_warnings:设置为true时,保存文件只弹窗提示错误,不会弹窗提示警告
- sublime设置文档格式
shift + command + p呼出面板,输入set+文档格式首字母,比如html,输入seth,java输入setj,选择对应的格式即可
以上是关于sublime笔记的主要内容,如果未能解决你的问题,请参考以下文章