Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

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.

Results:

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

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                    

\$      $                         

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

Tags:
Suggest a Tip!

Posted: Thursday, March 30, 2006 9:39 AM by saraford

Comments

Peter Ritchie said:

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?

Thanks!
# March 30, 2006 1:49 PM

Jandost Khoso said:

Really helped me alot and quite interesting to know these.
# March 31, 2006 12:33 AM

Stuart Dootson said:

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)
# March 31, 2006 1:49 AM

Jason Haley said:

# March 31, 2006 6:43 AM

catweazle said:

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?
# April 21, 2006 6:44 AM

Avi_H said:

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 ?
# May 7, 2006 7:41 AM

vedala said:

Works for VS 7.1 too!
# May 31, 2006 5:52 AM

Condor said:

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. :>)
# June 8, 2006 1:01 PM

prabhakaran said:

Hi Sara
does this work for VS 6.0 ?
# June 14, 2006 3:47 AM

Carl Scarlett said:

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!
# July 12, 2006 11:07 PM

andre said:

Thanks for the tip - I have long path names and this is saving me a lot of scrolling. :)
# September 6, 2006 12:31 PM

Ravikanth's Blog said:

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

# January 11, 2008 4:31 AM
New Comments to this post are disabled
Page view tracker