diff --git a/src/actions/actions.ts b/src/actions/actions.ts index 75bf8d4e565..f1326c68bf6 100644 --- a/src/actions/actions.ts +++ b/src/actions/actions.ts @@ -516,10 +516,20 @@ export class CommandInsertInInsertMode extends BaseCommand { const char = this.keysPressed[this.keysPressed.length - 1]; if (char === "") { - vimState.recordedState.transformations.push({ - type : "deleteText", - position : position, - }); + const selection = TextEditor.getSelection(); + + // Check if a selection is active + if (!selection.isEmpty) { + vimState.recordedState.transformations.push({ + type: "deleteRange", + range: new Range(selection.start as Position, selection.end as Position), + }); + } else { + vimState.recordedState.transformations.push({ + type: "deleteText", + position: position, + }); + } vimState.cursorPosition = vimState.cursorPosition.getLeft(); vimState.cursorStartPosition = vimState.cursorStartPosition.getLeft();