@@ -12,6 +12,10 @@ import {
1212 MarkdownCell
1313} from '@jupyterlab/cells' ;
1414
15+ import {
16+ ISettingRegistry
17+ } from '@jupyterlab/coreutils' ;
18+
1519import {
1620 CodeMirrorEditor
1721} from '@jupyterlab/codemirror' ;
@@ -29,7 +33,7 @@ const extension: JupyterLabPlugin<void> = {
2933 id : 'jupyterlab_vim' ,
3034 autoStart : true ,
3135 activate : activateCellVim ,
32- requires : [ INotebookTracker ]
36+ requires : [ INotebookTracker , ISettingRegistry ]
3337} ;
3438
3539class VimCell {
@@ -66,8 +70,7 @@ class VimCell {
6670 lvim . defineEx ( 'quit' , 'q' , function ( cm : any ) {
6771 commands . execute ( 'notebook:enter-command-mode' ) ;
6872 } ) ;
69-
70- ( CodeMirror as any ) . Vim . handleKey ( editor . editor , '<Esc>' ) ;
73+ lvim . handleKey ( editor . editor , '<Esc>' ) ;
7174 lvim . defineMotion ( 'moveByLinesOrCell' , ( cm : any , head : any , motionArgs : any , vim : any ) => {
7275 let cur = head ;
7376 let endCh = cur . ch ;
@@ -162,10 +165,11 @@ class VimCell {
162165 private _app : JupyterLab ;
163166}
164167
165- function activateCellVim ( app : JupyterLab , tracker : INotebookTracker ) : Promise < void > {
168+ function activateCellVim ( app : JupyterLab , tracker : INotebookTracker , settingRegistry : ISettingRegistry ) : Promise < void > {
169+ const id = plugin . id ;
170+ const { commands, shell } = app ;
166171
167- Promise . all ( [ app . restored ] ) . then ( ( [ args ] ) => {
168- const { commands, shell } = app ;
172+ Promise . all ( [ settingRegistry . load ( id ) , app . restored ] ) . then ( ( [ settings , args ] ) => {
169173 function getCurrent ( args : ReadonlyJSONObject ) : NotebookPanel | null {
170174 const widget = tracker . currentWidget ;
171175 const activate = args [ 'activate' ] !== false ;
0 commit comments