March 9, 2011, 8:30 a.m.
posted by fullstack
Search Files Quickly
Visual Studio's default Find function is pretty run-of-the-mill. Perk it up with incremental search.
Most users of Visual Studio are already familiar with the normal Find functionality, which lets you enter a search term, and then Visual Studio will look for that term in your current file. There is another type of search, an incremental search, that lets you enter your search term character by character while Visual Studio actively finds the first instance of that string in your current document. You can then quickly jump to each instance that is found in your document. All of this can be done with just a couple of quick keystrokes.
The first keystroke you need to remember is Ctrl-I (Edit.IncrementalSearch). First, you will need to open a document, then press this keystroke. This will turn incremental search on, which turns your cursor into what can only be described as a pair of binoculars with a down arrow. The next thing you need to do is simply start typing your search term character by character. Visual Studio will jump to the first match for that character combination and continue to search when you enter more characters. There is no text box area to type in; just start typing and you will see Visual Studio react. Figure shows incremental search in action. After having typed in the string "Car", you can see that it is now selected.
Visual Studio has highlighted the first instance of this search term, but you may be looking for a different instance of this term. You can simply press Ctrl-I again and Visual Studio will jump to the next matching instance in this document. You can also step backward by pressing Ctrl-Shift-I (Edit.ReverseIncrementalSearch). This keystroke will jump back to the previous matching instance in the document.
You can cancel your search at any time by pressing Esc or clicking anywhere with the mouse.
Incremental search is simple but can save a lot of time, especially when you are trying to jump quickly between different sections of a file or looking for every instance of a certain term.