diff --git a/src/actions/commands/actions.ts b/src/actions/commands/actions.ts index 33322a141f2..4f421bdf8a0 100644 --- a/src/actions/commands/actions.ts +++ b/src/actions/commands/actions.ts @@ -1286,9 +1286,9 @@ export class CommandInsertNewLineBefore extends BaseCommand { } @RegisterAction -class CommandNavigateBack extends BaseCommand { +class CommandJumpBack extends BaseCommand { modes = [Mode.Normal]; - keys = [[''], ['']]; + keys = [['']]; override runsOnceForEveryCursor() { return false; @@ -1299,6 +1299,24 @@ class CommandNavigateBack extends BaseCommand { } } +@RegisterAction +class CommandNavigateBack extends BaseCommand { + modes = [Mode.Normal]; + keys = [['']]; + + override isJump = true; + + public override async exec(position: Position, vimState: VimState): Promise { + await vscode.commands.executeCommand('workbench.action.navigateBack'); + + if (vimState.editor === vscode.window.activeTextEditor) { + // We didn't switch to a different editor + vimState.cursorStartPosition = vimState.editor.selection.start; + vimState.cursorStopPosition = vimState.editor.selection.end; + } + } +} + @RegisterAction class CommandNavigateForward extends BaseCommand { modes = [Mode.Normal];