Skip to content

Commit 891972e

Browse files
committed
Update README
1 parent 2f88cf4 commit 891972e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,24 @@ See [demo.js](https://github.com/brijeshb42/monaco-vim/tree/master/src/demo.js)
9191

9292
If you would like to customize the statusbar or provide your own implementation, see `initVimMode`'s implementation in [src/index.js](https://github.com/brijeshb42/monaco-vim/tree/master/src/index.js).
9393

94+
### Adding custom key bindings
95+
96+
Actual vim implementation can be imported as:
97+
98+
```js
99+
import { VimMode } from 'monaco-vim';
100+
```
101+
102+
#### Defining ex mode command
103+
104+
```js
105+
// VimMode.Vim.defineEx(name, shorthand, callback);
106+
VimMode.Vim.defineEx('write', 'w', function() {
107+
// your own implementation on what you want to do when :w is pressed
108+
localStorage.setItem('editorvalue', editor.getValue());
109+
});
110+
```
111+
112+
For advanced usage, refer [codemirror](https://github.com/codemirror/CodeMirror/issues/2840#issuecomment-58125831). `CodeMirror.Vim` is available as `VimMode.Vim`;
113+
94114
This implementaion of VIM is a layer between Codemirror's VIM keybindings and monaco. There may be issues in some of the keybindings, especially those that expect extra input like the Ex commands or search/replace. If you encounter such bugs, create a new [issue](https://github.com/brijeshb42/monaco-vim/issues). PRs to resolve those are welcome too.

0 commit comments

Comments
 (0)