marijnh/CodeMirror2 — Issue #202: Indent and dedent code by using Cmd+] and Cmd+[ on Mac OS X?
Author: Coreh
Created: 2011-10-09 21:03:41+00:00
State: open

Hi there,

On Mac OS X, the standard shortcuts for indenting and dedenting lines are `Cmd+]` and `Cmd+[`... (Or at least, these are the shortcuts used by both Xcode and TextMate.)

It seems that, at least with the default setup, CodeMirror does not implement these shortcuts. (It implements the same functionality with `Tab` and `Shift+Tab` instead)

As someone who's used to coding on the Mac, I find myself constantly trying to indent lines with these shortcuts, which doesn't work.

To make things worse, the same shortcuts (`Cmd+[` and `Cmd+]`) are used by all the major browsers on OS X for "Back" and "Forward" actions, which keeps me constantly navigating back whenever I press `Cmd+[`.

I'm not sure if overriding browser shortcuts by default by calling something like `e.preventDefault()` would be a good idea, but I would like to suggest adding at least a setting to enable this optionally.

If you guys are OK with something like that, I would be more than happy to contribute with a patch.