[vim bindings] Document events fired by vim mode

This commit is contained in:
benhormann 2020-07-08 07:15:31 +01:00 committed by GitHub
parent 3008203e8f
commit e2d786c758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -58,6 +58,7 @@
<li><a href="#vimapi">Vim Mode API</a>
<ul>
<li><a href="#vimapi_configuration">Configuration</a></li>
<li><a href="#vimapi_events">Events</a></li>
<li><a href="#vimapi_extending">Extending VIM</a></li>
</ul>
</li>
@ -3559,6 +3560,21 @@ editor.setOption("extraKeys", {
</dd>
</dl>
<h3 id="vimapi_events">Events</h3>
<p>VIM mode signals a few events on the editor instance. For an example usage, see <a href="https://github.com/codemirror/CodeMirror/blob/5.55.0/demo/vim.html#L101-L110">demo/vim.html#L101</a>.</p>
<dl>
<dt id="vimapi_commanddone"><code><strong>"vim-command-done"</strong> (reason: undefined)</code></dt>
<dd>Fired on keypress and mousedown where command has completed or no command found.</dd>
<dt id="vimapi_keypress"><code><strong>"vim-keypress"</strong> (vimKey: string)</code></dt>
<dd>Fired on keypress, <code>vimKey</code> is in Vim's key notation.</dd>
<dt id="vimapi_modechange"><code><strong>"vim-mode-change"</strong> (modeObj: object)</code></dt>
<dd>Fired after mode change, <code>modeObj</code> parameter is a <code>{mode: string, ?subMode: string}</code> object. Modes: <code>"insert", "normal", "replace", "visual"</code>. Visual sub-modes: <code>"linewise", "blockwise"</code>.</dd>
</dl>
<h3 id="vimapi_extending">Extending VIM</h3>
<p>CodeMirror's VIM mode implements a large subset of VIM's core