From a0bec1456443af29838715d7a3e5ffad07bb31eb Mon Sep 17 00:00:00 2001 From: johnfn Date: Thu, 1 Dec 2016 15:31:33 -0500 Subject: [PATCH] Add startInInsertMode configuration option. --- README.md | 3 +++ package.json | 4 ++++ src/configuration/configuration.ts | 1 + src/mode/modeHandler.ts | 8 ++++++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 604cc986a..f421a8a51 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ The following is a subset of the supported configurations; the full list is desc }] ``` +#### startInInsertMode + * Have VSCodeVim start in Insert Mode rather than Normal Mode. + #### useCtrlKeys * Enable Vim ctrl keys overriding common VS Code operations (eg. copy, paste, find, etc). Setting this option to true will enable: * `ctrl+c`, `ctrl+[` => `` diff --git a/package.json b/package.json index 9b5b86218..8ad9a0c84 100644 --- a/package.json +++ b/package.json @@ -326,6 +326,10 @@ "type": "boolean", "description": "Indent code automatically.", "default": true + }, + "vim.startInInsertMode": { + "type": "boolean", + "description": "Start in Insert Mode." } } } diff --git a/src/configuration/configuration.ts b/src/configuration/configuration.ts index ec09b140d..7e2f74a29 100644 --- a/src/configuration/configuration.ts +++ b/src/configuration/configuration.ts @@ -65,6 +65,7 @@ export class Configuration { autoindent = true; easymotion = false; incsearch = true; + startInInsertMode = true; @overlapSetting({ codeName: "tabSize", default: 8}) tabstop: number | undefined = undefined; diff --git a/src/mode/modeHandler.ts b/src/mode/modeHandler.ts index 9c2cfd7b6..0a4b3f1a4 100644 --- a/src/mode/modeHandler.ts +++ b/src/mode/modeHandler.ts @@ -177,7 +177,7 @@ export class VimState { /** * The mode Vim will be in once this action finishes. */ - private _currentMode = ModeName.Normal; + private _currentMode: ModeName; public get currentMode(): number { return this._currentMode; @@ -460,7 +460,11 @@ export class ModeHandler implements vscode.Disposable { this.vimState.historyTracker = new HistoryTracker(); this.vimState.easyMotion = new EasyMotion(); - this._vimState.currentMode = ModeName.Normal; + if (Configuration.getInstance().startInInsertMode) { + this._vimState.currentMode = ModeName.Insert; + } else { + this._vimState.currentMode = ModeName.Normal; + } this.setCurrentModeByName(this._vimState);