• Public
  • Public/Protected
  • All

The configuration options for a codemirror editor.


  • IConfig
    • IConfig




autoClosingBrackets: boolean

Whether to automatically close brackets after opening them.


codeFolding: boolean

Wheter to allow code folding

Optional coverGutterNextToScrollbar

coverGutterNextToScrollbar: boolean

When fixedGutter is on, and there is a horizontal scrollbar, by default the gutter will be visible to the left of this scrollbar. If this option is set to true, it will be covered by an element with class CodeMirror-gutter-filler.

Optional dragDrop

dragDrop: boolean

Controls whether drag-and-drop is enabled.

Optional electricChars

electricChars: boolean

Configures whether the editor should re-indent the current line when a character is typed that might change its proper indentation (only works if the mode supports indentation).

Optional extraKeys

extraKeys: CodeMirror.KeyMap | null

Can be used to specify extra keybindings for the editor, alongside the ones defined by keyMap. Should be either null, or a valid keymap value.

Optional fixedGutter

fixedGutter: boolean

Determines whether the gutter scrolls along with the content horizontally (false) or whether it stays fixed during horizontal scrolling (true, the default).

Optional foldGutter

foldGutter: boolean

Whether the folding gutter should be drawn


fontFamily: string | null

User preferred font family for text editors.


fontSize: number | null

User preferred size in pixel of the font used in text editors.

Optional gutters

gutters: string[]

Can be used to add extra gutters (beyond or instead of the line number gutter). Should be an array of CSS class names, each of which defines a width (and optionally a background), and which will be used to draw the background of the gutters. May include the CodeMirror-linenumbers class, in order to explicitly set the position of the line number gutter (it will default to be to the right of all other gutters). These class names are the keys passed to setGutterMarker.

Optional handlePaste

handlePaste: boolean

Whether the editor should handle paste events.


insertSpaces: boolean

Whether to insert spaces when pressing Tab.

Optional keyMap

keyMap: string

Configures the keymap to use. The default is "default", which is the only keymap defined in codemirror.js itself. Extra keymaps are found in the CodeMirror keymap directory.


lineHeight: number | null

User preferred text line height, as a multiplier of font size.


lineNumbers: boolean

Whether line numbers should be displayed.

Optional lineSeparator

lineSeparator: string | null

Explicitly set the line separator for the editor. By default (value null), the document will be split on CRLFs as well as lone CRs and LFs, and a single LF will be used as line separator in all output (such as getValue). When a specific string is given, lines will only be split on that string, and output will, by default, use that same separator.

Optional lineWiseCopyCut

lineWiseCopyCut: boolean

When enabled, which is the default, doing copy or cut when there is no selection will copy or cut the whole lines that have cursors on them.


lineWrap: "off" | "on" | "wordWrapColumn" | "bounded"

Control the line wrapping of the editor. Possible values are:

  • "off", lines will never wrap.
  • "on", lines will wrap at the viewport border.
  • "wordWrapColumn", lines will wrap at wordWrapColumn.
  • "bounded", lines will wrap at minimum between viewport width and wordWrapColumn.


matchBrackets: boolean

Whether to highlight matching brackets when one of them is selected.

Optional mode

mode: string | IMode

The mode to use.


readOnly: boolean

Whether the editor is read-only.


rulers: Array<number>

Column index at which rulers should be added.

Optional scrollPastEnd

scrollPastEnd: boolean

Whether to scroll past the end of the buffer.

Optional scrollbarStyle

scrollbarStyle: string

Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models.


selectionPointer: boolean | string

Defines the mouse cursor appearance when hovering over the selection. It can be set to a string, like "pointer", or to true, in which case the "default" (arrow) cursor will be used.

Optional showCursorWhenSelecting

showCursorWhenSelecting: boolean

Whether the cursor should be drawn when a selection is active.

Optional smartIndent

smartIndent: boolean

Whether to use the context-sensitive indentation that the mode provides (or just indent the same as the line before).


styleActiveLine: boolean | CodeMirror.StyleActiveLine

Whether to give the wrapper of the line that contains the cursor the class CodeMirror-activeline, adds a background with the class CodeMirror-activeline-background, and adds the class CodeMirror-activeline-gutter to the line's gutter space is enabled.


styleSelectedText: boolean

Whether to causes the selected text to be marked with the CSS class CodeMirror-selectedtext. Useful to change the colour of the selection (in addition to the background).


tabSize: number

The number of spaces a tab is equal to.

Optional theme

theme: string

The theme to style the editor with. You must make sure the CSS file defining the corresponding .cm-s-[name] styles is loaded.


wordWrapColumn: number

The column where to break text line.

Generated using TypeDoc