axk
axk

Reputation: 5394

How to highlight occurrences of a search term in text in Visual Studio?

How do I make all occurrences of a phrase (search term) in a file to be highlighted in the VS code editor?

Upvotes: 14

Views: 23195

Answers (10)

Doctor Rudolf
Doctor Rudolf

Reputation: 332

CTRL + F3

  • sends current word to find, regardless if it is selected or not
  • steps to the next occurrence
  • AND highlights all occurrences in editor

TIP: Use SHIFT+CTRL+F3 to "step backwards"

Upvotes: 2

NitroxDM
NitroxDM

Reputation: 5131

I open the file in Notepad++ and VS.

Update:

I recently found this extentnion for VS that makes it behave like notepadd++! You just need to select a phrase and it will highlight all of them.

Highlight all occurrences of selected word

Upvotes: 0

USER_NAME
USER_NAME

Reputation: 1037

You can use metalScroll extension - it is like rockscroll but it has rich and very useful functions. You can download this on:

http://code.google.com/p/metalscroll/downloads/list

go through with this before use:

http://code.google.com/p/metalscroll/

Upvotes: 7

Christopher
Christopher

Reputation: 1743

Microsoft has an (actually) useful VS plugin which solves this issue.

Power Tools: http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/

Once installed (restart VS afterwards), either highlight a section of text an hit CTRL+F to iterate all occurrences, or highlight text and let VS mark all matches for you in syntax highlighting.

Upvotes: 3

JohnnyBizzle
JohnnyBizzle

Reputation: 979

I copied and pasted the source code into Word 2007. This has highlight all option called 'Reading Highlight'. This keeps the highlighting on even when you search for another term.

Upvotes: 0

remotefacade
remotefacade

Reputation: 359

ReSharper can do this with the Highlight Usages feature: Highlight Usages In File

Course, you need ReSharper ;)

Upvotes: 11

Alex Duggleby
Alex Duggleby

Reputation: 8038

I noticed that a nice side effect of the Rock-Scroll plugin is that when you double-click a keyword it highlights all occurrences in the file (and in the rock scroll preview) as well.

http://microsoftdev.blogspot.com/2008/05/rock-scroll-visual-studio-plugin.html

Hope that helps, Alex

Upvotes: 16

Eoin Campbell
Eoin Campbell

Reputation: 44268

If you use the CTRL-i short cut, it'll do an inline incremental search. Keep pressing CTRL-i to jump to & highlight each subsequent occurence in the file.

I'm not sure that you can highlight all occurences at once. It may be possible with a plugin like ReSharper but not that I'm aware of.

Upvotes: 4

Andrew Theken
Andrew Theken

Reputation: 3480

When you run a "find" you can click "bookmark all" which will identify on the left which lines the search terms occur on, but you can't "highlight" the elements using visual studio, out of the box.

Upvotes: 6

Related Questions