CodeMirror: Search/Replace Demo

## Search/Replace Demo

<dl> <dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt> <dd>Whether, when indenting, the first N*<code>tabSize</code> spaces should be replaced by N tabs. Default is false.</dd> <dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt> <dd>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). Default is true.</dd> <dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt> <dd>A regular expression used to determine which characters should be replaced by a special <a href="#option_specialCharPlaceholder">placeholder</a>. Mostly useful for non-printing special characters. The default is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd> <dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt> <dd>A function that, given a special character identified by the <a href="#option_specialChars"><code>specialChars</code></a> option, produces a DOM node that is used to represent the character. By default, a red dot (<span style="color: red">•</span>) is shown, with a title tooltip to indicate the character code.</dd> <dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt> <dd>Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text is visual (pressing the left arrow moves the cursor left) or logical (pressing the left arrow moves to the next lower index in the string, which is visually right in right-to-left text). The default is <code>false</code> on Windows, and <code>true</code> on other platforms.</dd> </dl>

Demonstration of primitive search/replace functionality. The keybindings (which can be overridden by custom keymaps) are:

Ctrl-F / Cmd-F
  Start searching
Ctrl-G / Cmd-G
  Find next
Shift-Ctrl-G / Shift-Cmd-G
  Find previous
Shift-Ctrl-F / Cmd-Option-F
  Replace
Shift-Ctrl-R / Shift-Cmd-Option-F
  Replace all

Searching is enabled by including addon/search/search.js and addon/search/searchcursor.js. For good-looking input dialogs, you also want to include addon/dialog/dialog.js and addon/dialog/dialog.css.