Skip to content

Commit

Permalink
Initialize mode and cursor after startup
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Jul 16, 2016
1 parent aa8f605 commit 976a374
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function getAndUpdateModeHandler(): Promise<ModeHandler> {
return handler;
}

export function activate(context: vscode.ExtensionContext) {
export async function activate(context: vscode.ExtensionContext) {
extensionContext = context;

registerCommand(context, 'type', async (args) => {
Expand Down Expand Up @@ -105,6 +105,12 @@ export function activate(context: vscode.ExtensionContext) {
['left', 'right', 'up', 'down'].forEach(key => {
registerCommand(context, `extension.vim_${key}`, () => handleKeyEvent(`<${key}>`));
});

// Initialize mode handler for current active Text Editor at startup.
if (vscode.window.activeTextEditor) {
let mh = await getAndUpdateModeHandler()
mh.updateView(mh.vimState, false);
}
}

function registerCommand(context: vscode.ExtensionContext, command: string, callback: (...args: any[]) => any) {
Expand Down

0 comments on commit 976a374

Please sign in to comment.