Javascript examples for CodeMirror:Configuration
CodeMirror - AutoComplete "options" setting
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="https://codemirror.net/lib/codemirror.css"> <link rel="stylesheet" type="text/css" href="https://codemirror.net/addon/hint/show-hint.css"> <script type="text/javascript" src="https://codemirror.net/lib/codemirror.js"></script> <script type="text/javascript" src="https://codemirror.net/addon/hint/show-hint.js"></script> <script type="text/javascript" src="https://codemirror.net/addon/hint/javascript-hint.js"></script> <script type="text/javascript" src="https://codemirror.net/mode/javascript/javascript.js"></script> <style id="compiled-css" type="text/css"> .CodeMirror-hints {/* w ww.j a va 2 s . c o m*/ background-color: red; } .CodeMirror-hint { background-color: green; } .CodeMirror-hint-active { background-color: blue; color: yellow; } </style> <script type="text/javascript"> window.onload=function(){ var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, extraKeys: { "Ctrl-Space": "autocomplete" }, mode: { name: "javascript", globalVars: true } }); } </script> </head> <body> <textarea id="code">// type 'f' and press Ctrl+Space</textarea> </body> </html>