Key shortcut (hotkey) in Visual Studio to open a file inside your solution? - visual-studio

Is there a key shortcut in Visual Studio to find & open a file inside your solution without using Resharper or any other tools?

The accepted solution doesn't work on the newer versions.
For Visual Studio 2022, and 2019, 2017 do the following:
Update 1:
Now, pressing Ctrl + Shift + T and typing the file name works!
Update 2:
Since Visual Studio 2019 now it's possible to do a similar search via Ctrl + Q.
But it works slightly sloppy since it shows VS-related stuff as well.
Original answer:
Press these keys to open the "Go to" popup:
Ctrl +
,
Type there:
f Space Filename
Press Enter
Notes:
We are writing f to make VS search only on files. We can
also, use other letters. For more info type ? in the "Go to" popup.
For more keys and for Visual Studio 2012 to 2015 take a look at this
answer.

This answer is outdated; see here for latest information.
Not a single keystroke, but yes: `Ctrl+D > o f filename` (so that's five keystrokes before you start typing the filename). It then autocompletes the filename for you.
You need the Find box in the toolbar for this to work.
(If you change your mind about addins, SonicFileFinder is for this very purpose, and free.)

You can also use Ctrl + /, which puts the > in place for you automatically.

Similar to Just Shadow's answer I discover that, on Visual Studio 2017, you can do the following:
Press Ctrl + 1, then f
Or you could go to Tools -> Options -> Keyboard
and change the shortcut of Edit.GoToFile for whatever you like.
I replaced mine with: Ctrl + O

Related

How to replicate SublimeText ctrl+D in Visual Studio

I am used to work with Sublime text and trying to switch for Visual Studio for bigger projects, one of the feature of sublime that I absolutely love is its multiple select feature. You can hit ctrl + d multiple times to select next instance of the same word and then rewrite them all at once. Is there anything like this in Visual studio? I tryed to find it, but with no success.
Btw I am using Visual Studio 2015.
Visual studio 2017-19
The default shortcut is Alt+Shift+.
But if you want to add Ctrl+D
Go to the menu Tools > Options then select the Keyboard tab on the left
At the top you'll find an option to add extra keybindings, select Visual Studio Code. Save and That's it!
This works because Visual Studio Code has Ctrl+D, and other shortcuts similar to SublimeText
Alternatively you can manually add shortcuts
In the image, you can find any command to customize in the middle section.
The particular command you are interested is the one selected Edit.InsertNextMatchingCaret
Ctr R, R, this is used to replace the name of the varibals, depronto can serve it.
and you are encouraged here are all the shortcuts of vs2015 http://visualstudioshortcuts.com/2015/
Goto Tools / Options / Keyboard
Search for duplicate
Choose Edit.Duplicate
Remove the assignement for the current shortcut
Assign the shortcut you want
Ctrl + Shift + L seems to work.
Use Alt +leftClick and ctrl+F2 . For more reference you can go Official Website [link]https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-shortcuts-reference
I decided to use this Visual Studio Extension:
https://marketplace.visualstudio.com/items?itemName=JustinClareburtMSFT.SublimeVS

Keyboard shortcut for the "Update options..." variable drop down in Visual Studio 2013

In VS 2012 Ctrl + . would enter the drop down that is highlighted at the bottom right of a variable name when the name itself is changed. You could then update all references to the variable with the keyboard only. I cannot get this to work in VS 2013, and am missing it greatly! Does anyone have any idea how to get this working in 2013??
Thank you for your help!
Take a look at this. It has all the keyboard shortcuts available for VS2013. Including Ctrl + Dot
If it still does not work, have a look at the configuration here (This is for VS2012, but I would imagine its' is the same for 2013)
If you go Tools > Options > Environment > Keyboard. The command you're looking for is View.ShowSmartTag.
You can then assign the shortcut you want (ctrl + .) to this command.

Visual Studio - Shortcut to Navigate to Solution Explorer

Is there a keyboard shortcut in Visual Studio (aside from CTRL+TAB and selection) that would take me from inside a document directly into the solution explorer? I don't want to customize any shortcuts or change any default behavior.
CTRL+ALT+L
should shift focus to the Solution Explorer.
For visual studio 2012 use:
CTRL+[ + S this selects your current document in the solution explorer.
When using VS 2012 with the Visual C# 2005 keyboard mapping scheme:
CTRL+W, S
I find this easier to memorize: All shortcuts beginning with CTRL+W are for opening or navigating to W indows:
CTRL+W, S: S olution Explorer
CTRL+W, E: E rror list
CTRL+W, R: R esourceview
CTRL+W, A: Command window (A ction ...)
CTRL+W, T: T askview
CTRL+W, Q: Find Symbol Results
CTRL+W, X: Toolbo x
CTRL+W, C: C lassview
CTRL+W, P: P roperties
CTRL+W, B: B ookmarks
...
In Visual Studio 2012 you can now use CTRL+; as this is the default keyboard shortcut for the solution explorer search box.
On my windows 7 machine : Ctrl+ALT+L locks the computer.
For me
: Shift+ALT+L
works. (This could also be a resharper configuration)
shortcut ctrl [, S will focus current open file/document in solution explorer.
setting checkbox to true in "Track active in Solution Explorer" will automatically focus current open file/document in solution explorer (Tools->Options->Projects and solutions->General->"Track Active Item in Solution Explorer"=true
The default keyboard shortcut for opening/jumping to Solution Explorer is Ctrl + Alt + L.
Extended above : command name for sync tab with solution explorer is "SolutionExplorer.SyncWithActiveDocument"
Visual Studio
2015 and 2017 (by default) VS 2017 Shortcuts
Ctrl + [, S
Runs Keyboard Shortcut
SolutionExplorer.SyncWithActiveDocument
ReSharper
In Visual Studio 2015 and 2017 (by default) Resharper Docs
Shift + Alt + L
Which runs Resharper's Keyboard Shortcut
Resharper.Resharper_LocateInSolutionOrAssemblyExplorer
Both
Focus Solution Explorer
Highlight document
Scroll / expand nodes (as required to show that document)
Difference
Resharper's version also works with decompiled code. Locating decompiled symbols in the Assembly Explorer window.
To customise / it doesn't work :
Tools > Options > Environment > Keyboard
Search shortcut name (e.g. SolutionExplorer.SyncWithActiveDocument)
Assign (in Global) to Keyboard shortcuts as you like
I had this problem on a new machine build with VS 2013 and R# 8.2.
Keyboard option Resharper.Resharper_LocateInSolutionExplorer was correctly set to Shift+Alt+L, but it seemed to be only opening a parent folder and not selecting the actual file. As recommended in another post I enabled "Track active in Solution Explorer" in the VS Options.
This didn't fix the problem and wasn't what I want because in very large solutions I don't want the solution explorer jumping around to the current file in use. I disabled the Track feature and restarted VS, the LocateInSolutionExplorer feature then started working correctly. Some sort of shortcut precedence issue?
ctrl + [ + S.
This shortcut will highlight the currently opened document in solution explorer.
For AZERTY keyboards like mine, the default shortcut is Ctrl+), Ctrl+S
Ctrl+Alt+L works fine even in VS 2019.
But if you have reassigned the above key to some other command (by mistake in my case) then the name of the command is View.SolutionExplorer
You can search it in the Tools -> Options -> Environment -> Keyboard
or just do Ctrl+Q and search keymap.
And then search View.SolutionExplorer in the Show commands containing: and assign whichever key you want.
We just upgraded from VS2013 to VS2017, and I had to go looking for how to auto-select the active tab in the Solution Explorer. I often have to look for a document by finding a text-string from a screen, and love to have it select the document so I can see where it is.
Tracking the active document has been default behavior for a long time. VS2017 brought over ALL my other preferences, but not this one. Glad I found this thread--Thank you.

What's the equivalent for eclipse's ALT+UP/DOWN (move line) in Visual Studio?

In Eclipse, selecting a line and pressing Alt + ↑/↓ will move the line up and down, a quick way to avoid copy&paste.
Is there an equivalent in Visual Studio?
In Visual Studio 2013 and later, this functionality is built in. ALT + UP/DOWN will move a line up or down.
If you need this functionality in VS2012 (works with VS2010 too), take a look at the MoveLine Visual Studio Extension or the Productivity Power Tools suite.
ReSharper's Ctrl + Shift + Alt + ↑/↓/←/→ is even more powerful - when on the beginning of the line, it will move the entire line, but can also be used to move entire methods, change the order of parameters, etc.
For me in Visual Studio 2019 it comes default closed.
For open it:
Tools -> Options -> Keyboard then select Edit.MoveSelectedLinesUp, click "Press shortcut keys" input and press Alt + Up (or whatever you want for it). And the other one is Edit.MoveSelectedLinesDown, click "Press shortcut keys" input and press Alt + Down (or whatever you want for it).
This is now working out of the box with Visual Studio 2013, same way as in Eclipse.
For Visual Studio 2013:
Tools -> Options -> Keyboard then select Edit.MoveSelectedLinesDown, click "Press shortcut keys" input and press Alt + Down. You also have to select the scope of the shortcut to be within "Text Editor".
In Visual Studio 2013 and later, you can move lines up and down using Alt + ↑ / Alt + ↓. Unfortunately this will not adjust the indentation if you move between blocks, as of today only ReSharper (and all other IDE's by Jetbrains including Rider) can help you with that.
To move entire blocks of code around you can move the cursor to its head and press Ctrl + m twice fast to collapse it, and then use the command above to move it around.
Here is a neat reference to all default keyboard shortcuts in different versions of Visual Studio.
With the VSCommands extension, you have exactly that keyboard shortcut. And, by the way, a Stack OVerflow notification toolbar :)

In visual studio how to select word in text editor using keyboard

In earlier version of Microsoft Visual Studio products if user in text editor hit CTRL+W editor will do select the word where is pointer. Does that keyboard shortcut exists still in Visual Studio 2010?
In Tools | Options | Environment | Keyboard enter "Word" into "Show commands containing" and see all commands associated with words.
Here the command Edit.SelectCurrentWord is assigned to Ctrl + W, but your setup might be different. Ctrl + Shift + W is another common setting.
When using Resharper 'Shift + Ctrl + W' shortcut may be overriden and not working. Create new shortcut for Edit.SelectCurrentWord as 'Ctrl + W, Ctrl + W'. It works fine so you may use this and resharper shortcuts.
In Visual Studio 2019 the default keypress to select a word is:
Ctrl + Shift + W
The path i have to use is Debbugen (Debug), Optionen... (Options), Umgebung (Environment), Tastatur (Keyboard) and the first menu to expand to chose (Standard)([maybe]default).
I have no defined version control.
With version
Microsoft Visual Studio Community 2019
Version 16.10.1
Microsoft .NET Framework
Version 4.8.04.084

Resources