I opened few files during coding (both files in project and out project). After that, I close few in its (by ctrl+w and click the 'x' button).
When type ctrl+tab, I always see all opened files.
I try to restart VSCode, restart Windows but nothing change.
How do I close unnecessary files?
I use VS Code 1.0 + Windows 10.
Edit: This feature added in new versions
If you want to clear a specific item (not the whole list) from the recently opened list you have to
Press Ctrl + SHIFT + P
Type Remove From History (in earlier version it is Remove From Editor History) and press Enter
Choose/Find the file you want to clear
Source: link
Update 09.04.2020:
With the release of Visual Studio Code 1.44.0 you can easily remove a file using the UI. You see a closing x next to a file in this recently opened files view:
I could be mistaken but you don't want to delete, but "clear" recently opened files. If that is the case, then follow these steps in regards to VS Code version 1.15.0:
Press Ctrl + Shift + P
Then, within the Quick Open bar, type in >Clear Recently Opened
Press Enter, restart Visual Studio Code, and you should now see nothing under Recent.
Cmd + Shift + P
Clear Editor History
I have just found a workaround which seems to remove a single directory from recents, in case you do not wish to remove all of them.
Press ctrl+shift+p (you may need command+shift+p instead if using a Mac) and select File: Open Recent...
After you click on that, you should see a dropdown with your recently opened projects. Hover with the mouse on the one you want to delete and towards the end of the line you're hovering you should see a small x appearing
Click on that x and you're all done
For latest Visual Studio Code (1.54.2):
View-Command Palette or Ctrl + Shift + P
in the Command Palette dialog box: File: Clear Recently Opened
Restart Visual Studio Code
Press Ctrl + SHIFT + O
You can see recently opened projects and files list
Click the cross icon (X) to remove
Related
Alright so I recently did a clean install of visual studio and one thing changed from last time.
With vs2019, I think, came the different looking "Search History". Here are two screens of what exactly I mean with that. New looking history and here is the old one
I'm just not sure why now I only get the old one. I found out that the new one only appears with CTRL + SHIFT + F and the older one with regular CTRL + F. Is there are way so that the default CTRL + F window displays the same output window? (the newest one)
At first I didn't really like it that much, but now I prefer it. I'm running VS2019 Version 16.5.2.
Edit: And also, this is where I used to get the table version if anyone was wondering. Now it's just this old text thing.
In the "Find in Files" tool window, ensure "Find results table" is selected, not "Find results 1 window":
You can customize the keyboard shortcut.
Go to Tools\Options
Navigate to Environment\Keyboard
Under "Show commands containing", type Edit.FindinFiles
Under "Press shortcut keys", press the desired keyboard shortcut (i.e. in your case Ctrl+F)
Click Assign and then OK
See screenshot here
Tools > Options > Environment > Preview Features > Check "Use
Previous Find in Files"
Ctrl+Shift+F > Open Result options > Select
"Find results table"
Close the Find and Replace tool window and
revert the aforementioned "Use Previous Find in Files" setting
(optional)
Perform a search (either Find in Files or simply through
the standard Ctrl+F find prompt) Your results will then appear in
the advanced tabular "Find results table" window.
Presumably this setting is also found elsewhere but I haven't been able to find it without turning off the Find in Files preview feature.
https://stackoverflow.com/a/63789479
It returns your caret(aka cursor) to the place where you stopped writing code(very useful for fast code browsing)
Ctrl + - will move to the previously browsed line of code (Ctrl + Shift + - will move forward). You can download PDF versions of all the default keybindings in Visual Studio 2010 from this page.
ReSharper has Ctrl+Shift-Backspace to return to previous editing position. Or Ctrl+Shift+, (Comma) to browse some recent edition places.
In addition to what is mentioned in the other answers, you can use the undo/redo trick. As long as you want to navigate to the last edit position in the current file, a quick undo/redo will take you there.
You are looking for View.NavigateBackward. The actual keystroke depends on your personal settings, but it's probably Ctrl + -. If not, go to Tools/Customize/Commands/Keyboard to find out what it is for your setup.
There are ctrl+- and ctrl+shift+- That navigate backward and forward.
I have a file, xyz.cpp. I want to open two instances of this file in Visual studio (BTW, I am using Visual Studio 2005). Why would I want to do so? I want to compare two sections of the same file side by side. I know workarounds such as:
Make a copy of the file. But the problem is that it's not elegant, and I don't want to make copies every time I am faced with this.
I can split the window into two. The problem with split it that I can split it horizontally only. The result of a horizontal split is that the right half of my screen is white space.
If I were able to split it vertically or open two instances of the same file, it would increase the number of lines of code I can compare.
Visual Studio
Here's how to do it...
Select the tab you want two copies of
Select menu Window → New Window from the menu.
Right click the new tab and select New Vertical Tab Group
If New Window is not listed in the *Window menu note that the command does exist, even as of Visual Studio 2017. Add it to the Window menu using menu Tools → Customize → Commands. At that point decide where to put the New Window command and select Add Command.
VS Code
In Visual Studio Code version 1.25.1 and later
Way 1
You can simply left click on your file in the side-panel (explorer) and press Ctrl + Enter.
Way 2
Simply right click on your file in the Visual Studio Code side-panel (explorer) and select the first option open to the side.
For Visual Basic, HTML and JScript and RDL Expression, the Window > New Window option mentioned in PaulB's answer is disabled.
However an option can be changed in the Registry to enable the menu item.
All other languages do not restrict to a single code window so you can use PaulB's answer without editing the registry.
Enabling New Window in Windows Registry.[1] [2]
Go to the following registry key. This example is for Basic (Visual Basic), but the key is also there for HTML, JScript and RDL Expression.
64-bit OS: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Languages\Language Services\Basic
32-bit OS: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Languages\Language Services\Basic
Find the value Single Code Window Only and do one of the following:
Set it to 0
Rename the value
Delete the value (use caution!)
This will enable the "New Window" menu item, but it may still not be visible in the menu.
Adding Menu Item
To actually see the New Window menu item I had to add it back into the menu:
Tools > Customize... > Commands > Add Command...
Select 'Menu Bar' the select the 'Window' menu in the dropdown
Add Command... > Window > New Window > OK
Restoring Registry Value
Copy-paste this to notepad, save as a .reg file and import the file into your registry to restore the initial setting.
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Languages\Language Services\Basic]
"Single Code Window Only"=dword:00000001
Go to menu → Windows → New Window:
You can use the Windows → New Window option to duplicate the current window. See more at: Why I like Visual Studio 2010? Undock Windows
Open the file (if you are using multiple tab groups, make sure your file is selected).
Menu Window → Split
(alternately, there's this tiny nub just above the editor's vertical scroll bar - grab it and drag down)
This gives you two (horizontal) views of the same file. Beware that any edit-actions will reflect on both views.
Once you are done, grab the splitter and drag it up all the way (or menu Window → Remove Split).
How to open two instances of the same file side by side in Visual Studio 2019:
Open the file.
Click Window → New Window.
A new window should be open with the same file.
Click on Window → New Vertical Document Group.
Result:
With the your file opened, go to command window (menu View → Other Windows → Command window, or just Ctrl + Alt + A)
Type:
Window.NewWindow
And then
Window.NewVerticalTabGroup
worked for me (Visual Studio 2017).
Or using menus:
Menu Window → New Window
Menu Window → New vertical tap group
Luke's answer didn't work for me. The 'New Window' command was already listed in the customize settings, but not showing up in the .js tabs context menu, despite deleting the registry setting.
So I used:
Tools
Customize...
Keyboard...
Scroll down to select Window.NewWindow
And I pressed and assigned the shortcut keys, Ctrl + Shift + W.
That worked for me.
==== EDIT ====
Well, 'worked' was too strong. My keyboard shortcut does indeed open another tab on the same JavaScript file, but rather unhelpfully it does not render the contents; it is just an empty white window! You may have better luck.
Window menu, New Horizontal/Vertical Tab Group there will do, I think.
When working with Visual Studio 2013 and VB.NET I found that you can quite easily customize the menu and add the "New Window" command - there is no need to mess with the registry!
God only knows why Microsoft chose not to include the command for some languages...?
For newer versions (such as Visual Studio 2017)
Select the window you want to duplicate.
Go to the window tab and click on split at the top of the list.
When you are done, click it again to toggle it off.
For file types, where the same file can't be opened in a vertical tab group (for example .vb files) you can
Open 2 different instances of Visual Studio
Open the same file in each instance
Resize the IDE windows & place them side by side to achieve your layout.
If you save to disk in one instance though, you'll have to reload the file when you switch to the other. Also if you make edits in both instances, you'll have to resolve on the second save. Visual Studio prompts you in both cases with various options. You'll simplify your life a bit if you edit in only the one instance.
I don't have a copy of Visual Studio 2005, but this process works on Visual Studio 2008:
Open xyz.cpp along with some other file.
Right click on tab header and select new vertical tab group.
Left click on that other file in the first tab group.
Open xyz.cpp through solution explorer again.
You should now have two instances of file in separate vertical tab groups.
To work on two sections of one long file, simply use a shortcut (Ctrl + \) or click on the split editor window while you are on the selected tab. The icon is on the top-right of the Visual Studio Code.
What is the shortcut to open a file within your solution in Visual Studio 2008 (+ Resharper)?
Ctrl + T (ReSharper, Goto, type) will open a class file for you.
Looks like Ctrl + Shift + T opens files.
Depending on your keymap, Ctrl + Shift + N will open any file in the solution, or Ctrl + N will open any type.
If the standard toolbar is visible the following will open any file in the solution (resharper is not necessary).
Ctrl + D places you in the Find textbox. >of f will provide a dropdown with all files that start with f with path information after the filename to distinguish name collisions. Complete the filename, or arrow down to the correct one and hit enter to open it in the editor.
I attended a presentation recently where Kirk Jackson showed how to add aliases to the command window in Visual Studio. Bear with me, it gets better.
So it went like this:
Open Command Window and type
alias fo File.FileOpen
Now in your editor window hit Ctrl + / to put the focus into the Find box on the toolbar
If you use the prefix > this is command window (sneaky huh?) so type:
fo
and intellisense kicks in and shows you the names of the folders and files in the solution.
The alias is persistent between Visual Studio sessions.
Not exactly a keyboard shortcut but using this technique you can access any command in Visual Studio from the keyboard.
You should also check out Kirk's list of essential VS tips and tricks
It depends on the key mapping that you have set.
With default keymapping: Do Ctrl + T to open a type and Ctrl + Shift + T to open a file.
With IntelliJ like mapping : Do Ctrl + N to open a type and Ctrl + Shift + N to open a file.
Visit the following links for all your key mapping.
ReSharper 4 Default Keymap: Visual Studio scheme
http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap.pdf
ReSharper 4 Default Keymap: ReSharper 2.x / IDEA scheme
http://www.jetbrains.com/resharper/docs/ReSharper40DefaultKeymap2.pdf
I use Delphi for many years, and although I have now moved on to Visual Studio I still fondly remember numbered bookmarks (CTRL+K+1 to set bookmark 1, CTRL+Q+1 to goto bookmark 1).
Is there a Visual Studio equivalent? I'm find the dumb bookmarks in VS a chore after Delphi. I want to bookmark then return to a specific place in the file.
DPack can give you numbered bookmarks in VisualStudio.
Ctrl K + Ctrl K - Add/Remove Bookmark on Line
Ctrl K + Ctrl N - Go to Next Bookmark
Ctrl K + Ctrl P - Go to Previous Bookmark
There are other options as well. Look under Edit->Bookmarks menu,
More a comment on your original question than an actual answer but Delphi has had much easier to remember (and type) keyboard shortcuts than what you quote available for quite some time now:
Set bookmark 1: Ctrl-Shift-1
Go to bookmark 1: Ctrl-1
If you ever go back to Delphi, this should make your life so much easier! ;)
Just to amplify Lars Truijens answer. DPack is a GExperts like plugin for visual studio. I found it great help when moving from the Delphi IDE to Visual Studio.
I find this one also very useful:
CtrlK + CtrlL - Clear alll bookmarks
There is a Bookmark Window. Go to menu View/Bookmark Window (Ctrl+K, Ctrl+W).
In there you can see all your bookmarks and rename them. That is a lot better than just seeing the numbers.
For some reason they don't allow to order that list by clicking in a column header, but you can drag the bookmarks and accommodate them in the order you want.
VSBookmarks gives something like the fantastic Delphi bookmarks feature. Tested and works in Visual Studio 2019.
Extensions > Search "VSBookmarks" (v1.7 at time of writing)
Install and restart Visual Studio
Use Ctrl + Shift + N to set a bookmark
Use Ctrl + N to move to a previous bookmark
There will likely be conflicts with existing keyboard shortcuts. To view and edit these:
Tools > Options > Environment > Keyboard
In "Press shortcut keys" type Ctrl + Shift + 1
See which command(s) are currently assigned to the shortcut
Find the command in the list and remove the shortcut
Repeat for Ctrl + Shift + 1 through Ctrl + 9
VSBookmarks applies only within the current file (which is the Delphi behaviour), but is not configurable with just a single colour for the bookmark.
Delphi is an awesome language and editor. Thanks to Sergey Vinyar and Alessandro Fragnani (for the Numbered Bookmarks extension in Visual Studio Code) for keeping the flame alive.
I use:
CTRL-F2 toggle bookmark
F2 next bookmark
SHIFT-F2 previous bookmark
CTRL-SHIFT-F2 clear all bookmarks
BTW, after using Visual Studio for years I just found about a couple of months ago that you can press ALT and drag mouse to mark a column or a square.