Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support Codemirror's included key mappings #19833
Summary of Changes
First of all, this includes CodeMirror 5.35.0 so it's the same as #19809
Since it doesn't make much sense to load all key mappings at the same time (you use either zero or one of them), key mapping info will not be loaded unless needed. As a result, the addons file (a bundle of several codemirror plugins) is much smaller now.
Use CodeMirror. If you are familiar with Vim, Emacs, or Sublime Text, use one of those key mappings. Notice the change in CodeMirror's behavior.
CodeMirror should work as usual. Additional Key Mapping modes should work somewhat like other editors.
Documentation Changes Required
I guess not.
Couple of observations:
If these are non issues, then ok to be RTC.
But it is not 'none' or 'off'. It is CodeMirror's default. It does have some keys mapped by default. For example, Ctrl-D deletes a line, Ctrl-Z is undo, etc. Changing to a different one overwrites this. So then, with Sublime key mapping, Ctrl-D doesn't delete a line but duplicates your current selection to the next matching string. And so on.
Hmm. That's not the way I thought I coded it and it's not the way it worked when I tested it. Let's both check again.
@Quy Ah, yes. You're right about that. In fact, if you were to use CodeMirror without going to the settings first, you'd still have Vim but it's true that the settings reset to default. Well, really the only way to fix that is to modify the form data in onContentPrepareData which doesn't even get fired on editor plugins so it would require adding a content plugin just for this one thing... I think not worth it.