============================= CodeMirror keyboard shortcuts ============================= First published at 5/19/2018 on https://defkey.com/codemirror-shortcuts CodeMirror is a JavaScript component, used to provide a code editor in a web browser. It has features like syntax highlighting, auto indentation, big document handling, customizable key bindings including Vi and Emacs modes. CodeMirror has 91 shortcuts and we have listed all of them below. General (Windows) ----------------- Ctrl + A Select all Esc When multiple selections are present, deselect all but the primary selection Ctrl + D Delete line under the cursor Ctrl + Z Undo last change Ctrl + Y Redo the last undone change Ctrl + U Undo the last change to the selection, or if there are no selection-only changes at the top of the history, undo the last change Alt + U Redo the last change to the selection, or the last text change if no selection changes remain Ctrl + Home Move cursor to the start of the document Ctrl + End Move cursor to the end of the document Alt + Left arrow Move cursor to the start of the line Home Move to the start of the text on the line, or if we are already there, go to the actual start of the line (including whitespace) Alt + Right arrow Move cursor to the end of the line Up arrow Move the cursor up one line Down arrow Move the cursor down one line Page Up Move the cursor up one screen, and scroll up by the same distance Page Down Move the cursor down one screen, and scroll down by the same distance Left arrow Move the cursor one character left, going to the previous line when hitting the start of line Right arrow Move the cursor one character right, going to the next line when hitting the end of line Ctrl + Left arrow Move to the left of the group before the cursor. A group is a stretch of word characters, a stretch of punctuation characters, a newline, or a stretch of more than one whitespace character Ctrl + Right arrow Move to the right of the group after the cursor Shift + Backspace Delete the character before the cursor Del Delete the character after the cursor Ctrl + Backspace Delete to the left of the group before the cursor Ctrl + Del Delete to the start of the group after the cursor Shift + Tab Auto-indent the current line or selection Ctrl + ] Indent the current line or selection by one indent unit Ctrl + [ Dedent the current line or selection by one indent unit Tab If something is selected, indent it by one indent unit. If nothing is selected, insert a tab character Enter Insert a newline and auto-indent the new line Insert Toggle the overwrite flag Ctrl + S Not defined by the core library, only referred to in key maps. Intended to provide an easy way for user code to define a save command Ctrl + F Find Ctrl + G Find next Shift + Ctrl + G Find previous Shift + Ctrl + F Replace Shift + Ctrl + R Replace all. Not defined by the core library, but defined in the search addon (or custom client addons) General (Mac) ------------- Cmd + A Select all Ctrl + K Emacs-style line killing. Deletes the part of the line after the cursor. If that consists only of whitespace, the newline at the end of the line is also deleted Cmd + D Delete line under the cursor Cmd + Backspace Delete the part of the line from the left side of the visual line the cursor is on to the cursor Cmd + Del Delete the part of the line from the cursor to the right side of the visual line the cursor is on Cmd + Z Undo last change Shift + Cmd + Z Redo the last undone change Cmd + Y Redo the last undone change Cmd + U Undo the last change to the selection, or if there are no selection-only changes at the top of the history, undo the last change Shift + Cmd + U Redo the last change to the selection, or the last text change if no selection changes remain Cmd + Up arrow Move cursor to the start of the document Cmd + Home Move cursor to the start of the document Cmd + End Move cursor to the end of the document Cmd + Down arrow Move cursor to the end of the document Control + A Move cursor to the start of the line Home Move to the start of the text on the line, or if we are already there, go to the actual start of the line (including whitespace) Control + E Move cursor to the end of the line Cmd + Right arrow Move the cursor to the right side of the visual line it is on Cmd + Left arrow Move the cursor to the left side of the visual line it is on. If this line is wrapped, that may not be the start of the line Up arrow Move the cursor up one line Control + P Move the cursor up one line Down arrow Move the cursor down one line Control + N Move the cursor down one line Page Up Move the cursor up one screen, and scroll up by the same distance Shift + Control + V Move the cursor up one screen, and scroll up by the same distance Page Down Move the cursor down one screen, and scroll down by the same distance Control + V Move the cursor down one screen, and scroll down by the same distance Left arrow Move the cursor one character left, going to the previous line when hitting the start of line Control + B Move the cursor one character left, going to the previous line when hitting the start of line Right arrow Move the cursor one character right, going to the next line when hitting the end of line Control + F Move the cursor one character right, going to the next line when hitting the end of line Option + Left arrow Move to the left of the group before the cursor. A group is a stretch of word characters, a stretch of punctuation characters, a newline, or a stretch of more than one whitespace character Option + Right arrow Move to the right of the group after the cursor Shift + Backspace Delete the character before the cursor Control + H Delete the character before the cursor Del Delete the character after the cursor Control + D Delete the character after the cursor Option + Backspace Delete up to the start of the word before the cursor Option + D Delete up to the end of the word after the cursor Option + Backspace Delete to the left of the group before the cursor Control + Option + Backspace Delete to the start of the group after the cursor Alt + Del Delete to the start of the group after the cursor Shift + Tab Auto-indent the current line or selection Cmd + ] Indent the current line or selection by one indent unit Cmd + [ Dedent the current line or selection by one indent unit Tab If something is selected, indent it by one indent unit. If nothing is selected, insert a tab character Control + T Swap the characters before and after the cursor Enter Insert a newline and auto-indent the new line Insert Toggle the overwrite flag Cmd + S Not defined by the core library, only referred to in key maps. Intended to provide an easy way for user code to define a save command Cmd + F Find Cmd + G Find next Shift + Cmd + G Find previous Cmd + Option + F Replace Shift + Cmd + Option + F Replace all. Not defined by the core library, but defined in the search addon (or custom client addons) Source: CodeMirror manual Last modified on(UTC): Saturday, January 16, 2021 Defkey © All rights reserved.