Shawn
Shawn

Reputation: 19803

Reopen last closed tab in Visual Studio

Is there any way to reopen the last closed tab in Visual Studio? Similar to Ctrl+Shift+t in FireFox and Chrome?

Upvotes: 191

Views: 83055

Answers (10)

Safeer Ahmed Farooqi
Safeer Ahmed Farooqi

Reputation: 59

In VS Code Version 1.80.1

  1. Go to Settings
  2. Keyboard Shortcuts
  3. Find workbench.action.localHistory.restoreViaPicker
  4. Set Short Cut Key For it.
  5. Press the desired shortcut key.
  6. Select the previously closed file with correct time of at which you saved file. File Restored Hurrah!

Upvotes: 0

Trident D'Gao
Trident D'Gao

Reputation: 19690

Also consider Alt+F, Alt+F.

(push Alt and hold it, now while holding, press F and then press F again).

This will open the Recent Files menu. There, you can use arrow keys to select a file and open it by hitting Enter, or just use your mouse.

enter image description here

Upvotes: 80

nawfal
nawfal

Reputation: 73183

This is not exactly an equivalent, but it can be helpful, so I would mention it.

There is a much simpler way actually, which is to navigate backward (Ctrl+-). Even if the file is closed, VS opens up the file in a new tab. Of course this is useful only in opening the closed tab immediately after you have closed the tab (ie, if you haven't navigated anywhere else much).


Update:
This is now possible in VS 17.3. By using the Ctrl+K, Ctrl+Z keyboard shortcut, or navigating to the menu item under Window > Restore Closed Tab. Reference: https://devblogs.microsoft.com/visualstudio/visual-studio-2022-17-3-is-now-available/

Upvotes: 236

Etienne Weil
Etienne Weil

Reputation: 165

In Visual Studio Code 2020 you can use Shift+Ctrl+T, which is associated with Reopen Closed Editor. This should do what you're expecting.

Upvotes: 13

lennoxGER
lennoxGER

Reputation: 524

Once you use VS 2022 V.17.3 it is pretty simple:

CTRL+K, CTRL+Z

enter image description here

Upvotes: 7

BotMaster3000
BotMaster3000

Reputation: 482

You can actually do this (at least in Visual Studio 2019) by pressing Ctrl+T,R which opens a little window which shows the last opened windows.

Source

As NotAPro pointed out, the combination I mentioned seems to have changed to Ctrl+1,Ctrl+R

Upvotes: 11

Stormenet
Stormenet

Reputation: 26468

You can with the Visual studio Power Commands using Ctrl + Shift + Z

Upvotes: 49

Simon
Simon

Reputation: 34840

in VS 2010 "PowerCommands for Visual Studio 2010"

http://visualstudiogallery.msdn.microsoft.com/e5f41ad9-4edc-4912-bca3-91147db95b99/

Adds a command "Undo Close"

Upvotes: 11

Chris Doggett
Chris Doggett

Reputation: 20757

If you're using VS 2008, PowerCommands offers a "Undo Close" pane, featuring your recently closed documents, or like David said, check the File menu. PowerCommands doesn't limit the number of files it shows, though.

Upvotes: 30

David Yancey
David Yancey

Reputation: 2030

I don't know of way to open the last closed tab, but you can open your most recent file through your File Menu and the top one should be your most recently closed tab.

Upvotes: 20

Related Questions