Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I keep undo history after saving on Visual Studio Code

I'm using latest version of VS code (1.9.0).

After I undo (ctrl+z) something, and save the file (ctrl+s), then I cannot redo anymore (ctrl+y).

I would like to go back and forth during the editor is running same as Sublime or other editor. Can anyone solve this problem? Thank you.

like image 607
Eliot Avatar asked Feb 03 '17 09:02

Eliot


People also ask

How do I undo saved changes in VS code?

Click the (...) button and then select Undo Last Commit to undo the previous commit. The changes are added to the Staged Changes section.

Does vscode keep history?

Visual Studio Code allows us to check the history of navigated files in Navigation History lists. You can open this window from “Goto–> Navigation History” or by just simply pressing Ctrl + Tab. This will bring list of all previously navigated files with in Visual Studio Code.

Does Visual Studio keep history?

Ken Cross. VSHistory maintains the history of files in your Visual Studio projects every time they are saved. Any saved version can be viewed or a diff with the current version can be displayed. NOTE: The version of VSHistory compatible with Visual Studio 2022 can be found here.

How do I redo changes in Visual Studio code?

In Visual Studio, LLBLGen Pro uses the global undo / redo shortcuts for undo/redo: Ctrl-Z for undo and Ctrl-Y for redo. The undo-redo for the text editor switches to Ctrl-Shift-Z for undo and Ctrl-Shift-Y for redo in this case.


Video Answer


2 Answers

For people getting to this question that want to disable the persistence of the undo stack after a file is closed, this too appears to be coming to v1.45.

See https://github.com/microsoft/vscode/issues/94778 and https://github.com/microsoft/vscode/pull/96317 and v1.45 Release Notes:

"files.restoreUndoStack": false

Set to false to disable undo stack items after a file is closed. the default is true.

like image 102
Mark Avatar answered Oct 19 '22 10:10

Mark


Hope this will work.

shift + command + z 

It will redo what you expected in Sublime Text (command + y )

like image 11
Murtaza JAFARI Avatar answered Oct 19 '22 09:10

Murtaza JAFARI