Codemirror v6 looks like not so easy to configure as previous versions. In my custom component I get codemirror editor with this code who use for options sintax like v5:

$editor = Editor::getInstance('codemirror');
$options = array(
    'syntax' => 'php', 
    'mode' => 'application/x-httpd-php', 
    'indentUnit' => '4',
    'indentWithTabs' => true,
    'smartIndent' => true


<?= $editor->display('myEditorId', 'My custom content', '100%', '900', '300', '3', false, 'myEditorId', null, null, $options); ?>

Tab key doesn't work as I expected in a code editor because leave the editor and direct the focus to the next control. I would like to configure codemirror inserting a tab (4 spaces) pressing Tab key, and remove a tab pressing Ctrl+Tab.

Also, autoindent works but with 2 spaces (default configuration), and I need to configure it to 4 espaces.

Please, someone have configured Codemirror with these parameters? How could I do it?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.