Codemirror -extrakeys

by jean-philippe janecek

HTML

<link rel="stylesheet" href="https://codemirror.net/theme/ambiance.css">
<script src="https://codemirror.net/lib/codemirror.js"></script>
<link rel="stylesheet" href="https://codemirror.net/lib/codemirror.css">
<script src="https://codemirror.net/3/mode/shell/shell.js"></script>
<form>
  <textarea id="code" name="code">
$ PROP=configuration.properties
$ TMPP=configuration.tmp
$ sed -e "s/\(export app_image_name=\)\".*\"/\1\"demo\/jenkins\"/" $PROP > $TMPP && mv $TMPP $PROP
$ sed -e "s/\(export app_container_name=\)\".*\"/\1\"jenkins\"/" $PROP > $TMPP && mv $TMPP $PROP
$ sed -e "s/\(export app_shared_volumes=\)\".*\"/\1\"-v \$PWD\/volumes\/jenkins_home:\/var\/\/jenkins_home\"/" $PROP > $TMPP && mv $TMPP $PROP
$ sed -e "s/\(export app_shared_volumes=\)\".*\"/\1\"-v \$PWD\/volumes\/jenkins_home:\/var\/jenkins_home\"/" $PROP > $TMPP && mv $TMPP $PROP
$ sed -e "s/\(export app_exposed_ports=\)\".*\"/\1\"-p 8080:8080\"/" $PROP > $TMPP && mv $TMPP $PROP
$ edjangertemplate properties=configuration
> Initialize edjanger.properties from template and configuration file (configuration.properties)...
  . use main configuration file: "configuration.properties"  ...
  . process template: "./edjanger.template"  ...
  . use local configuration file: "./configuration.properties"  ...
edjanger:WARNING edjanger properties file "./edjanger.properties" already exist, do you want to replace it (y/n) ?
y
  . create "./edjanger.properties" file from template "./edjanger.template" and configuration file "./configuration.properties"

  </textarea>
</form>

CSS

.CodeMirror {
  border: 1px solid #eee;
  height: auto;
}

JavaScript

$(document).ready(function() {
  var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
    mode: 'shell',
    theme: "ambiance",
    lineNumbers: true,
    matchBrackets: true
  });
});