Alt+Left navigate backs to the last cursor position and if the last cursor position was in a different file then it navigates to that file.
But, I want to navigate to the last cursor position with respect to the currently focused file only. It is really useful when I have 2 split file editors and want to navigate back exclusive to each other.
Is it possible?
I hope you understand the question, let me know if further explanation is required.
You can use the cursor undo
/ cursor redo
commands via the command palette.
Undo also comes with a keyboard shortcut by default (Mac: cmd+u, Windows/Linux: ctrl+u), and you can configure a keybinding for redo.
Note, however, that the file's cursor history is only saved while it has focus in an editor group. So if you have split editors, multiple focused files can have their own cursor history saved. And if the same file is opened and focused in two different editor groups, it has two different cursor history states.
But as soon as you focus another file in an editor group, the previously focused file will lose its cursor history (in that editor group).
The VSCode team is currently working on a variety of open issues to improve local history across the board, but I don't believe that saving cursor history for blurred (or closed) files is in the plans yet. If you need that functionality, you may want to create a feature request.
Note, with VSCode 1.40 (Oct. 2019):
The Soft Undo
command has been renamed to Cursor Undo
This action is useful, for example when using Ctrl+D to select the next match and going one time too far, as it undoes only the last cursor state change.
Additionally, we now have added Cursor Redo
, which redoes the previously undone cursor state change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With