theme: string
theme:‘monokai‘
引入对应的css, <link rel="stylesheet" href="../theme/monokai.css">
indentUnit: integer
缩进,默认2
keyMap: string
keyMap: "sublime" 使用sublime中快捷键
引入对应的js, <script src="../keymap/sublime.js"></script>
extraKeys: object
自定义快捷键
extraKeys: {"Ctrl-Q": "autocomplete"}
需引入:
<script src="../addon/hint/show-hint.js"></script>
<script src="../addon/hint/javascript-hint.js"></script>
<link rel="stylesheet" href="../addon/hint/show-hint.css">
// 使用tab键extraKeys: { "Tab": function(cm){ var spaces = Array(cm.getOption("indentUnit") + 1).join(" "); cm.replaceSelection(spaces); } }
gutters: array<string>
自定义lineNumber
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter","CodeMirror-lint-markers"]
CodeMirror-foldgutter:展开收起
需引入:
<link rel="stylesheet" href="../addon/fold/foldgutter.css" />
<script src="../addon/fold/foldcode.js"></script>
<script src="../addon/fold/brace-fold.js"></script>
<script src="../addon/fold/brace-fold.js"></script>
CodeMirror-lint-markers:代码错误检测
需引入:
<script src="http://ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js"></script>
<script src="http://rawgithub.com/zaach/jsonlint/79b553fb65c192add9066da64043458981b3972b/lib/jsonlint.js"></script>
<script src="http://rawgithub.com/stubbornella/csslint/master/release/csslint.js"></script>
<script src="../addon/lint/lint.js"></script>
<script src="../addon/lint/javascript-lint.js"></script>
<script src="../addon/lint/json-lint.js"></script>
<script src="../addon/lint/css-lint.js"></script>
<link rel="stylesheet" href="../addon/lint/lint.css">