@@ -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' ;
@@ -38,7 +42,7 @@ const extension: JupyterLabPlugin<void> = {
3842 id : 'jupyterlab_vim' ,
3943 autoStart : true ,
4044 activate : activateCellVim ,
41- requires : [ INotebookTracker ]
45+ requires : [ INotebookTracker , ISettingRegistry ]
4246} ;
4347
4448class VimCell {
@@ -77,8 +81,7 @@ class VimCell {
7781 lvim . defineEx ( 'quit' , 'q' , function ( cm : any ) {
7882 commands . execute ( 'notebook:enter-command-mode' ) ;
7983 } ) ;
80-
81- ( CodeMirror as any ) . Vim . handleKey ( editor . editor , '<Esc>' ) ;
84+ lvim . handleKey ( editor . editor , '<Esc>' ) ;
8285 lvim . defineMotion ( 'moveByLinesOrCell' , ( cm : any , head : any , motionArgs : any , vim : any ) => {
8386 let cur = head ;
8487 let endCh = cur . ch ;
@@ -186,10 +189,11 @@ class VimCell {
186189 private _app : JupyterLab ;
187190}
188191
189- function activateCellVim ( app : JupyterLab , tracker : INotebookTracker ) : Promise < void > {
192+ function activateCellVim ( app : JupyterLab , tracker : INotebookTracker , settingRegistry : ISettingRegistry ) : Promise < void > {
193+ const id = plugin . id ;
194+ const { commands, shell } = app ;
190195
191- Promise . all ( [ app . restored ] ) . then ( ( [ args ] ) => {
192- const { commands, shell } = app ;
196+ Promise . all ( [ settingRegistry . load ( id ) , app . restored ] ) . then ( ( [ settings , args ] ) => {
193197 function getCurrent ( args : ReadonlyJSONObject ) : NotebookPanel | null {
194198 const widget = tracker . currentWidget ;
195199 const activate = args [ 'activate' ] !== false ;
0 commit comments