Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you configure the Visual Studio Find Options?

Is it possible to get the VS 2012 find dialog to always use Current Document and reset case & whole-word when I press Ctrl+F? Currently it remembers my last options and I often forget to turn them off.

Also it sometimes switches to All open documents on its own which totally throws me off. I haven't yet figured out why or when this happens.

I've searched for registry keys and extensions but so far nothing useful has turned up.

like image 544
laktak Avatar asked Jan 16 '13 10:01

laktak


People also ask

How do I get to options in Visual Studio?

This dialog box lets you change global settings for the Visual Studio code and text editor. To display this dialog box, select Options on the Tools menu, expand the Text Editor folder, and then select General.

How do I search for a specific code in Visual Studio?

Search across files. VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term. Search results are grouped into files containing the search term, with an indication of the hits in each file and its location.

How do I use Find and Replace code in Visual Studio?

You can find and replace text in the Visual Studio editor by using Find and Replace (Ctrl+F or Ctrl+H) or Find/Replace in Files (Ctrl+Shift+F or Ctrl+Shift+H). You can also find and replace only some instances of a pattern by using multi-caret selection.

How do I search an entire solution in Visual Studio?

Ctrl + Shift + F – Find in Solution Sometimes you want to search across your entire solution. You can double-click each item in the “Find Results” window to navigate to that instance of the search term you searched for.


2 Answers

It's not possible to get the dialog or the quick find UI to always choose a specific scope out of the box. During beta of VS 2012, this behavior was implemented where CTRL+F would always set the scope to Current Document and Ctrl+Shift+F would set the scope Entire Solution upon invocation of the commands. A lot of users were unhappy with this behavior, so it was reverted. There are no registry keys that you can set to alter this behavior.

Visual Studio always tries to reuse the last used scope. There are circumstances at which that scope is not available, and that'll cause the IDE to change the scope on you. Let's suppose you do a search in "Current Project", after that you close the entire solution and then invoke the dialog. The scope will have to change to something else.

You probably know about this, but Ctrl+F3 will search for the word that is under the caret and it'll always perform that search with the Whole Word option on in the current document. Perhaps that'll suit your needs.

like image 81
Ameen Avatar answered Sep 17 '22 03:09

Ameen


I've published a Visual Studio "SmartFind" extension to fix this issue.

http://visualstudiogallery.msdn.microsoft.com/015611c4-b357-4672-8977-f3ec92f0b808

like image 31
laktak Avatar answered Sep 18 '22 03:09

laktak