TIP: How to get rid of /the/really/long/file/path/that/shows/up/in/searchresults

Quick tips to make you more efficient in Visual Studio

Customizing search output in Visual Studio

When you do a Find in Files (CTRL+SHIFT+F), by default the output displays the file path which can fill up the results window.

Did you know you can use a registry key to customize the output of your search?

Create a string value in the registry called "Find result format"

  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Find for Visual Studio 2013
  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Find for Visual Studio 2012
  • HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find for Visual Studio 2010

Here are the different values you can specify for the registry string. I like to use a string value of $f$e($l,$c):$t\r\n

  • $f is the filename
  • $e is the extension
  • $l is the line
  • $c is the column
  • $t is the text on the line
  • \n      newline 
  • \r carriage return

The end result? Simpler search results (as long as you don't need the file path)

 

If you liked this tip, check out the series Visual Studio Time Savers, where I share my favourite time saving tips. Give them a try and let me know what you think or your own! There are more coming, so make sure to check back often or subscribe to the RSS feed to get tips as soon as they are posted.

If one of these has helped you become more productive, make sure to comment on and share the videos.

Have a tip that has made you more productive? Let us know by tweeting to @cdndevs (hashtag #vstips) or commenting on the Microsoft Developer Facebook wall.