Shorten Find Results Filepath Name
You can change the VS search result formatting by changing the registry.
According to the article Customize how Find in Files results are displayed in the Find Results Window:
- Open up RegEdit
- Go to
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find
- Add a new string called
Find result format
with a value of$f$e($l,$c):$t\r\n
DANGER: This involves hacking the Registry so use this tip at your own risk!
Further, here's the syntax to use if you'd like to customize the string further:
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\$
- $
Things are different on Visual Studio 2017. You won't find the registry keys for Visual Studio 2017 anymore as Visual Studio 2017 now stores registry keys in a private binary file under %VsAppDataFolder%\privateregistry.bin
.
However, according to this link, there is still a way to find and modify registry keys for Visual Studio 2017.
- Close Visual Studio 2017
- Open regedit
- Select
HKEY_LOCAL_MACHINE
from the left bar - Select File > Load Hive...
- Load the privateregistry.bin file from
%localappdata%\Microsoft\VisualStudio\15.0_[instanceid]{RootSuffix}\privateregistry.bin
. TheRootSuffix
for a normal VS installation will be blank. This is mostly used for the experimental instance - Name the key whatever you want (e.g. "VS2017") when prompted
- From there, you should be able to view the entries just like any normal registry.
- Customise it according to accepted answer's suggestions.
- Important! Once you're finished, you need to make sure that you "Unload" the private registry, by selecting the "root" key ("VS2017" in this example) and selecting File > Unload Hive . If you don't do this, VS won't be able to read the
privateregistry.bin
file when it runs, causing major problems.
Update: It also works on Visual Studio 2019 (version 16.0) too.