Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,14 @@
"type": "boolean",
"description": "Start in Insert mode."
},
"vim.startInInsertModeSchemes": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"markdownDescription": "List of document URI schemes that should automatically start in Insert mode. For example, use `[\"comment\"]` for GitHub PR comment editors, or `[\"comment\", \"gitlens\"]` for multiple schemes."
},
"vim.handleKeys": {
"type": "object",
"description": "Delegate certain key combinations back to VS Code to be handled natively.",
Expand Down
2 changes: 2 additions & 0 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ class Configuration implements IConfiguration {

startInInsertMode = false;

startInInsertModeSchemes: string[] = [];

statusBarColorControl = false;

statusBarColors: IModeSpecificStrings<string | string[]> = {
Expand Down
6 changes: 6 additions & 0 deletions src/configuration/iconfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ export interface IConfiguration {
*/
startInInsertMode: boolean;

/**
* List of document URI schemes that should automatically start in Insert mode.
* For example, ['comment'] for GitHub PR comment editors.
*/
startInInsertModeSchemes: string[];

/**
* Enable changing of the status bar color based on mode
*/
Expand Down
8 changes: 7 additions & 1 deletion src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
): Promise<ModeHandler> {
const modeHandler = new ModeHandler(handlerMap, textEditor);
await modeHandler.vimState.load();
await modeHandler.setCurrentMode(configuration.startInInsertMode ? Mode.Insert : Mode.Normal);

// Check if this editor's URI scheme should start in Insert mode
const scheme = textEditor.document.uri.scheme;
const shouldStartInsert =
configuration.startInInsertMode || configuration.startInInsertModeSchemes.includes(scheme);

await modeHandler.setCurrentMode(shouldStartInsert ? Mode.Insert : Mode.Normal);
modeHandler.syncCursors();
return modeHandler;
}
Expand Down
1 change: 1 addition & 0 deletions test/testConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class Configuration implements IConfiguration {
incsearch = true;
inccommand = '' as const;
startInInsertMode = false;
startInInsertModeSchemes: string[] = [];
statusBarColorControl = false;
statusBarColors: IModeSpecificStrings<string | string[]> = {
normal: ['#8FBCBB', '#434C5E'],
Expand Down