Customize how Find in Files results are displayed in the Find Results Window

Keyboard:  CTRL + SHIFT + F
Menu:  Edit -> Find and Replace -> Find in Files
Command:  Edit.FindinFiles
Versions:  2008,2010
Published: 1/3/2010
Code:  vstipFind0002 

   

image

 

You can customize your Find in Files results to show what you want to see and how you want to see it.

Example:  You don't want to view the entire file path shown in the Find Results tool window.

So instead of this:

image

 

 

You want this:

image

 

No problem! :)

 

DANGER:  This involves hacking the Registry so use this tip at your own risk!

  1. Open up RegEdit

  2. Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find

  3. Add a new string called Find result format with a value of $f$e($l,$c):$t\r\n

    image

  4. Hop into Visual Studio and run a Find in Files search (NOTE: You do not need to restart VS to see the changes made in the Registry, which is great for testing different string combos)

 

Here are valid values you can use in the string:

 

Files

$p      path                       

$f      filename               

$v      drive/unc share            

$d      dir                        

$n      name                       

$e      .ext                   

    

Location

$l      line                        

$c      col                        

$x      end col if on first line, else end of first line

$L      span end line

$C      span end col

Text

$0      matched text                

$t      text of first line

$s      summary of hit

$T      text of spanned lines

Char

\n      newline                   

\s      space                     

\t      tab                        

\\      slash                    

\$      $