Customize your Find in Files Results experience!

Another awesome hidden editor feature…

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.

Find all "using", Match case, Whole word, Subfolders, Find Results 1, "Entire Solution"

C:\Documents and Settings\someuser\Local Settings\Temp\~vs90.cs(1):using System;

Matching lines: 1 Matching files: 1 Total files searched: 1

Instructions:  (since these involve modifying registry settings, please use at your own risk!)

1. Go to HKCU\Software\Microsoft\VisualStudio\8.0\Find
2. Add a new string called Find result format with a value of $f$e($l,$c):$t\r\n where

$f is the filename

$e is the extension

$l is the line

$c is the column

$t is the text on the line

Note:  You don’t have to restart Visual Studio to pick up on your registry changes.


Find all "using", Match case, Whole word, Subfolders, Find Results 1, "Entire Solution"

~vs90.cs(1,1):using System;

Matching lines: 1 Matching files: 1 Total files searched: 1

Full list of items you can specify in the registry


$p      path                       

$f      filename               

$v      drive/unc share            

$d      dir                        

$n      name                       

$e      .ext                       


$l      line                       

$c      col                        

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

$L      span end line

$C      span end col


$0      matched text               

$t      text of first line

$s      summary of hit

$T      text of spanned lines


\n      newline                   

\s      space                     

\t      tab                       

\\      slash                    

\$      $                         

If you come up with a great combination of values, please leave a comment and share with the group!

Tags: VSTips

Comments (12)

  1. Peter Ritchie says:

    Brilliant!  Since VS stuck the project files in the Document And Settings/User directory (then added "Visual Studio 2005/Projects") file paths have been huge and have been driving me nuts with all the scrolling in the find window.

    Is there something similar for compiler warnings?


  2. Really helped me alot and quite interesting to know these.

  3. Stuart Dootson says:

    Nice – it’s just a shame there’s no option to show relative paths when you’re searching sub-folders (e.g. searching a solution)

  4. catweazle says:

    Is it possible for the matched text substring to be highlighted in a color?

    As a separate question, is it possible for the status bar to indicate the total number of lines in the file in addition to the current line the inseration point is at?

  5. Avi_H says:

    The problem is that some time I need to see the path of the file. Or at list the last part of it because I have lots of projects and I need to know the location of the class.

    Is there a way to see only part of the path ?

  6. vedala says:

    Works for VS 7.1 too!

  7. Condor says:

    Thanks Sara,

    This is what i was looking for.  I am sure it will save me time from having to scroll all the way out to the right. :>)

  8. prabhakaran says:

    Hi Sara

    does this work for VS 6.0 ?

  9. Carl Scarlett says:

    Thanks Sara.  Knowing that registry location has helped me solve another annoying problem:

    The "Look in" combo on the "Find in Files" search toolbar can be typed into (which I have accidentally done on occasion).  The text has no use, and cannot be removed using UI.

    However, if I close VS, edit them out of the registry, and reload then they are finally removed.  Joy!

  10. andre says:

    Thanks for the tip – I have long path names and this is saving me a lot of scrolling. 🙂

  11. If you spend considerable time in reformatting your find in files results, then this tip is might helpful