码迷,mamicode.com
首页 > 其他好文 > 详细

(二)CodeMirror - 配置项

时间:2014-11-22 18:46:10      阅读:1036      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   使用   sp   java   

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">

 

(二)CodeMirror - 配置项

标签:style   blog   http   io   ar   color   使用   sp   java   

原文地址:http://www.cnblogs.com/huair_12/p/4115450.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!