Visual Studio : Is there a way to Perform a "Find in files" with one single shortcut?

visual studio 2017
visual studio code
visual studio 2015
visual studio community
visual studio 2019 offline installer
visual studio free
how to run code in visual studio 2019
visual studio vs visual studio code

I want to select an expression in code and type Ctrl+Whatever so it has the same result as [ Ctrl+Shift+F AND Clicking on "Find All" ]

EDIT : [Ctrl+Shift+F AND Hitting Enter] may be quicker than clicking but I still want something more specific and faster

Remark : I am NOT interested the Find All References shortcut.

You could use a macro. I recorded and modified one in VS2010:

Sub FindAllFiles()
    DTE.Find.FindWhat = DTE.ActiveDocument.Selection.ToString()
    DTE.Find.Target = vsFindTarget.vsFindTargetFiles
    DTE.Find.MatchCase = False
    DTE.Find.MatchWholeWord = False
    DTE.Find.MatchInHiddenText = True
    DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
    DTE.Find.SearchPath = "Entire Solution"
    DTE.Find.SearchSubfolders = True
    DTE.Find.FilesOfType = ""
    DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1
    DTE.Find.Action = vsFindAction.vsFindActionFindAll
    If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
        Throw New System.Exception("vsFindResultNotFound")
    End If
End Sub

The macro can be set to a keyboard shortcut. See:

Visual Studio 2019 IDE, The Visual Studio integrated development environment is a creative The search box is a great way to rapidly find what you need in Visual Studio. a simple project to try out some of the things you can do with Visual Studio. Visual Studio : Is there a way to Perform a “Find in files” with one single shortcut? Ask Question Asked 9 years, 1 month ago. Active 1 year, 2 months ago.

Not that I would be aware of it. Ctrl+Shift+F + ENTER (ENTER instead of Clicking on "Find All") is probably the closest it comes. And if you are a touch typist it is as fast as a single shortcut.


Now, that the question has changed my answer makes no sense anymore. Go with a macro like Fosco answered it.

Overview of Visual Studio, For now, it displays an empty window that shows Form1 in the title bar. Here's how to run your app. Choose one of the following methods: Choose  Visual Studio Code Tips and Tricks "Tips and Tricks" lets you jump right in and learn how to be productive with Visual Studio Code. You'll become familiar with its powerful editing, code intelligence, and source code control features and learn useful keyboard shortcuts.

I have a similar macro in use like @Fosco.

' Members for the search methods
Private matchCase As Boolean = True
Private searchWindowOne As Boolean = False

Public Sub SearchFiles(ByVal fileTypes As String, ByVal searchPath As String)
    searchWindowOne = Not searchWindowOne
    DTE.Find.Target = vsFindTarget.vsFindTargetFiles
    DTE.Find.MatchCase = matchCase
    DTE.Find.MatchWholeWord = matchWholeWord
    matchCase = True
    matchWholeWord = True
    DTE.Find.MatchInHiddenText = True
    DTE.Find.Action = vsFindAction.vsFindActionFindAll
    DTE.Find.SearchPath = searchPath
    If (searchWindowOne) Then
        DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1
        DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults2
    End If
    DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
    DTE.Find.SearchSubfolders = True
    DTE.Find.FilesOfType = fileTypes
    DTE.Find.FindWhat = GetClipboard()
    If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
        Throw New System.Exception("vsFindResultNotFound")
    End If
End Sub

Public Sub ChangeMatchCase()
    matchCase = False
    matchWholeWord = False
End Sub

It adds a little more flexibility to the original approach. One of the good things is that is searches into both find windows alternating. That means your last two searches are always accessible. Of course this can't be used to be directly mapped to a shortcut but it allows to do this:

Sub SearchInProject()
    SearchFiles("*.*", "Current Project")
End Sub
Sub SearchInCode()
    SearchFiles("*.h;*.cpp", "Entire Solution")
End Sub

...and so on. These can then be mapped to shortcuts and allow real one key searching. As you might have noticed I added a switch for match case that can be activated by the macro ChangeMatchCase for the next search. In my setting I mapped different searches to double keystrokes. So Ctrl+F,Ctrl+G searches globally, Ctrl+F,Ctrl+Dsearches in the project, ... you get the point. I have similar mappings for all debug stuff starting with Ctrl+D,. This was maybe the single most important performance boost I had in the last years.

Visual Studio IDE, Code Editor, Azure DevOps, & App Center , Try Visual Studio IDE, Code or Mac for free today. How to install offline By downloading and using Visual Studio Code, you agree to the license terms and  Repair Visual Studio. 06/15/2020; 3 minutes to read +6; In this article. Sometimes your Visual Studio installation becomes damaged or corrupted. A repair is useful for fixing install-time issues across all install operations, including updates.

Step 2: Run your picture viewer app, Take advantage of real-time collaboration on any device for any project. so you can edit, run, and debug your applications from any device. you have a personalized experience that looks and feels the way you like. Build and clean projects and solutions in Visual Studio. 11/04/2016; 3 minutes to read +3; In this article. By using the procedures in this topic, you can build, rebuild, or clean all or some of the projects or project items in a solution. For a step-by-step tutorial, see Walkthrough: Building an application.

Download Visual Studio 2019 for Windows & Mac, What can you do with Visual Studio? With Visual Studio you can build any app, game, or extension using any language of your choice. Learn  There is not a simple way to check shortcut availability. If you want to add a shortcut, follow these steps: Check the list of Visual Studio 2013 shortcuts to determine if there are similar commands to group yours with. Go to Tools > Options > Environment > Keyboard and test your shortcut. Check each keyboard mapping scheme listed under "Apply

Visual Studio Codespaces - Cloud IDE, A project contains all of the information and files required to create and run a The easiest way to start coding in Visual Studio is by creating a new project from​  What you probably didn’t know is that as of Visual Studio 2017 version 15,3 Preview there is an even easier way to target a line and Set Next Statement. 1. Hover over the line of code where you want to move the yellow arrow.

  • Did not know about this, hough I knew something like that had to be available. That will open the path to a series of Macros I will write to make my dull code-typing life easier. ThanX.
  • Besides, This solution is perfect because it makes it possible to have different Shortcuts/Macros for specific find scopes (SOlution/Project/Etc...). ThanX 4 Sharing
  • I would suspect that because the OP wants a single shortcut rather than having to hit 3 keys and then enter.
  • @ChrisF: Well, I can't help it if it doesn't exists. If you are a touch typist this is as quick as a single shortcut ;)
  • @bratao: No, he did not! The OP wrote Clicking on "Find All" and you don't have to do that, you can just press the ENTER key.
  • Yes Yes Yes, My Bad. I did not Specify that you're right. I do know that indeed. Of course it is far better that clicking. But I still look for soemting more efficient. Edited the question to be more precise
  • Well, now that you have changed your question my answer makes of course no sense anymore. Ctrl+Shift+F + ENTER works fast enough for me, if you wan't a single shortcut, go with a macro.