diff -ENwbur wysiwyg_orig//editors/codemirror.inc wysiwyg/editors/codemirror.inc
--- wysiwyg_orig//editors/codemirror.inc	1970-01-01 03:00:00.000000000 +0300
+++ wysiwyg/editors/codemirror.inc	2011-07-25 16:00:08.320022700 +0300
@@ -0,0 +1,147 @@
+<?php
+
+/**
+ * @file
+ * Editor integration functions for codemirror.
+ */
+
+/**
+ * Plugin implementation of hook_editor().
+ */
+function wysiwyg_codemirror_editor() {
+  $editor['codemirror'] = array(
+    'title' => 'CodeMirror',
+    'vendor url' => 'http://codemirror.net',
+    'download url' => 'http://codemirror.net',
+    'library path' => wysiwyg_get_path('codemirror'),
+    'libraries' => array(
+      '' => array(
+        'title' => 'CodeMirror',
+        'files' => array(
+          'lib/codemirror.js',
+        ),
+      ),
+    ),
+    'version callback' => 'wysiwyg_codemirror_version',
+    'settings callback' => 'wysiwyg_codemirror_settings',
+    'plugin callback' => 'wysiwyg_codemirror_plugins',
+    'load callback' => 'wysiwyg_codemirror_load',
+    'versions' => array(
+      '2' => array(
+        'js files' => array('codemirror.js'),
+        'css files' => array('codemirror.css'),
+      ),
+    ),
+  );
+  return $editor;
+}
+
+/**
+ * Detect editor version.
+ *
+ * @param $editor
+ *   An array containing editor properties as returned from hook_editor().
+ *
+ * @return
+ *   The installed editor version.
+ */
+function wysiwyg_codemirror_version($editor) {
+  $fp = $editor['library path'] . '/README.md';
+  if (!file_exists($fp)) {
+    return;
+  }
+  $fp = fopen($fp, 'r');
+  $line = fgets($fp);
+  if (preg_match('@([0-9\.]+)$@', $line, $version)) {
+    fclose($fp);
+    return $version[1];
+  }
+  fclose($fp);
+}
+
+/**
+ * Perform additional actions upon loading this editor.
+ *
+ * @param $editor
+ *   A processed hook_editor() array of editor properties.
+ * @param $library
+ *   The internal library name (array key) to use.
+ */
+function wysiwyg_codemirror_load($editor, $library) {
+  drupal_add_css($editor['library path'] . '/lib/codemirror.css');
+  drupal_add_css($editor['library path'] . '/theme/default.css');
+
+  drupal_add_js($editor['library path'] . '/lib/codemirror.js');
+  drupal_add_js($editor['library path'] . '/mode/clike/clike.js');
+  drupal_add_js($editor['library path'] . '/mode/css/css.js');
+  drupal_add_js($editor['library path'] . '/mode/diff/diff.js');
+  drupal_add_js($editor['library path'] . '/mode/haskell/haskell.js');
+  drupal_add_js($editor['library path'] . '/mode/htmlmixed/htmlmixed.js');
+  drupal_add_js($editor['library path'] . '/mode/javascript/javascript.js');
+  drupal_add_js($editor['library path'] . '/mode/php/php.js');
+  drupal_add_js($editor['library path'] . '/mode/stex/stex.js');
+  drupal_add_js($editor['library path'] . '/mode/xml/xml.js');
+}
+
+/**
+ * Return runtime editor settings for a given wysiwyg profile.
+ *
+ * @param $editor
+ *   A processed hook_editor() array of editor properties.
+ * @param $config
+ *   An array containing wysiwyg editor profile settings.
+ * @param $theme
+ *   The name of a theme/GUI/skin to use.
+ *
+ * @return
+ *   A settings array to be populated in
+ *   Drupal.settings.wysiwyg.configs.{editor}
+ */
+function wysiwyg_codemirror_settings($editor, $config, $theme) {
+  /* Defaults */
+  $settings = array(
+    'mode' 			 => 'application/x-httpd-php', 
+    'indentUnit' 	 => 2,
+    'indentWithTabs' => false,
+    'tabMode' 		 => 'shift',
+    'enterMode' 	 => 'indent',
+    'electricChars'  => false,
+    'lineNumbers' 	 => false, 
+    'gutter' 		 => false,
+    'readOnly' 		 => false,
+    'matchBrackets'  => false
+  );
+
+  $all_settings = array_keys($settings);
+
+  if (is_array($config['buttons']['default'])) {
+    foreach ($config['buttons']['default'] as $key => $value) {
+      if ($value) {
+        if (in_array($key, $all_settings)) {
+          $settings[$key] = ($value != 0);
+        }
+      }
+    }
+  }
+  
+  return $settings;
+}
+
+/**
+ * Return internal plugins for this editor; semi-implementation of hook_wysiwyg_plugin().
+ */
+function wysiwyg_codemirror_plugins($editor) {
+  return array(
+    'default' => array(
+      'buttons' => array(
+        'lineNumbers' 	 => t('Line Numbers'),
+        'matchBrackets'  => t('Match Brackets'),
+        'electricChars'  => t('Electric Characters'),
+		'indentWithTabs' => t('Indent With Tabs'),
+		'gutter' 		 => t('Gutter'),
+		'matchBrackets'  => t('Match Brackets')
+      )
+    ),
+    'internal' => TRUE,
+  );
+}
\ В конце файла нет новой строки
diff -ENwbur wysiwyg_orig//editors/css/codemirror.css wysiwyg/editors/css/codemirror.css
--- wysiwyg_orig//editors/css/codemirror.css	1970-01-01 03:00:00.000000000 +0300
+++ wysiwyg/editors/css/codemirror.css	2011-07-25 16:06:34.606593900 +0300
@@ -0,0 +1 @@
+.CodeMirror {border: 1px solid #ddd}
\ В конце файла нет новой строки
diff -ENwbur wysiwyg_orig//editors/js/codemirror.js wysiwyg/editors/js/codemirror.js
--- wysiwyg_orig//editors/js/codemirror.js	1970-01-01 03:00:00.000000000 +0300
+++ wysiwyg/editors/js/codemirror.js	2011-07-25 16:13:10.542579500 +0300
@@ -0,0 +1,36 @@
+(function($) {
+
+/* Maintain a list of active editors on the page */
+var instances = new Object; 
+
+/**
+ * Attach this editor to a target element.
+ *
+ * See Drupal.wysiwyg.editor.attach.none() for a full desciption of this hook.
+ */
+Drupal.wysiwyg.editor.attach.codemirror = function(context, params, settings) {
+  var textArea = document.getElementById(params.field);
+  if (textArea) {
+    instances[params.field] = CodeMirror.fromTextArea(textArea, settings);
+  }
+  
+  if (params.resizable) {
+    jQuery('.CodeMirror-scroll').css({
+	  'height'	   : 'auto',
+	  'overflow-y' : 'hidden',
+	  'overflow-x' : 'auto'
+	});
+  }
+};
+
+/**
+ * Detach a single or all editors.
+ *
+ * See Drupal.wysiwyg.editor.detach.none() for a full desciption of this hook.
+ */
+Drupal.wysiwyg.editor.detach.codemirror = function(context, params) {
+  instances[params.field].toTextArea();
+  delete instances[params.field];
+};
+
+})(jQuery);
\ В конце файла нет новой строки
