Change keymap for search addon

I am completely new to CodeMirror, and I’ve searched the manual and the forums here, but can not make sense of what I need to do.

I have CodeMirror on my site, and I’ve added the lint and search addons.
Search works, except the ‘Alt-F’ keymap (persistent search) fails in Chrome - that is the default for opening the Chrome menu.
I want to change the mapping from ‘Alt-F’ to ‘Ctrl-Alt-F’, but I do not understand what all I’m supposed to do. I’ve read something about ‘setOptions’ and ‘extraKeys’ and ‘addKeyMap’ and and another ‘enable???’ something, but I’m not even sure how to reference the correct function. As near as I can figure, I need to do something like:

var map = {
    'Ctrl-Alt-f': function(cm) {
        // call to persistent search function here;
    }};

And then, either:

myCodeMirror.setOption('extraKeys', map);

or

myCodeMirror.addKeyMap(map);

HELP!!

Thanks,
Mitch

1 Like

The problem may be that CodeMirror expects letter key names in uppercase, so "Ctrl-Alt-F".

    var map = {
        'Ctrl-Q': function (cm) {
            alert('Ctrl-Q');
        }
    };
    codeMirrorInstance.addKeyMap(map);
    CodeMirror.normalizeKeyMap(map);