How to cancel search highlight in Eclipse - eclipse

When I search something in Eclipse, the search items stay highlighted for some time. How do I remove this after I have found what I was looking for?

Remove your matches in the search view, that will remove the highlighting. I.e., click the button with the two X's in the search view.
If you cannot see that view, navigate to window -> show view -> Search

AFIAK, the search result view has a toolbar button to clear the search results. This removes the highlighting in the editor.

An alternative way is to run a search that will yield no results. For example file search, containing text - leave this field empty, files - some stupid extension like ".qwe".
For people concerned that https://stackoverflow.com/a/3545215/6012102 removes search results from history.
Select the search from history, press "Run the current search again" (2 rotating arrows icon). This will run the search and you will get all the results back (this brings back the text highlight as well unfortunately).

Disable Preferences->General->Text Editors->Annotations->Search Results->Text as.

For a single instance, delete the line and undo it: Ctrl+DCtrl+Z. This is faster than the other answers, and worked when they failed (for some buggy JSP I had).

Related

Eclipse - How to disable "direction" on find/replace dialog

In eclipse, when using the CTRL+F dialog, it is a bit annoying to search for some word in a file and having to select the direction you want to search (forward or backward) or having to put the cursor focus at the top of the file to search forward.
Is it possible to disable this direction option and search for words just like Chrome does? (when searching in Chrome, if you reach the last coincidence and press next again, it will go back to the first one immediately).
In the Find/Replace dialog in the section Options there is the checkbox Wrap search for that.
The Wrap search option of the Find/Replace dialog is also applied to the Find Next (Ctrl+K) command.
Alternatively, you can use Incremental Find (Ctrl+J) which is a Find without a dialog: in the Incremental Find mode the entered search string is displayed in the status bar and by hitting Ctrl+J again you go to the next match. On the last match you have to hit Ctrl+J twice to go to the first match.

remove search highlighting via keyboard shortcut in Eclipse

After doing a Java or File search in Eclipse, the (purple) highlighting of matches in files persists indefinitely, distracting me from whatever task I try to accomplish after I complete my search.
I know that I can open the Search view (by pressing Alt+Shift+Q,S, or by clicking its icon) and then click the "Remove All Matches" button that looks like an advertisement for Dos Equis, but I get tired of all this view-activating and clicking.
I want to clear search results in Eclipse using just the keyboard. Is there a way to do this?
Press Ctrl+F7. Keep on Pressing F7 when reach search view. Release Ctrl Key.
Close search view(in fact any view) as explained here
Once search view is removed from the current perspective search highlight will be removed automatically. If you want to see it again then open search view.

Aptana/Eclipse Find Next Shortcut - for Find in Files

i see this post. but i still dont see any way to be able to quickly step through a bunch of search results, making edits, and using a shortcut key to advance to the next result. the Find Next shortcut only works in the Search Tab window, not in the Editor window, where i have focus, while editing. I have to keep clicking on the next result and then clicking in the editor window to make my edits.
Seems so basic, i must be missing something.
i now see that Ctl+K is set to do something similar.
Ctrl+Alt+G is a default shortcut to search currently selected text in the whole workspace (Search>Text>Workspace from menu).
There are no default key mappings for searching selected text in file and in the current project but I find it very usefull added (Ctrl+Alt+F, and Ctrl+Alt+P respectively (Window>Preferences>Keys))

How to enable "live search" in eclipse?

In Komodo Edit, an input field is available in the toolbar. When I type text in it, it highlights matching search results. Is there something like this in Eclipse, either directly or via a plugin?
As TK Gospodinov has already mentioned, there is an Incremental option in Find/Replace (Ctrl+F) dialog.
There is also a special key binding for Incremental search in Eclipse (and personally I use it more frequently). From Eclipse Tips and Tricks:
Use Edit > Incremental Find Next (Ctrl+J) or Edit > Incremental Find Previous (Ctrl+Shift+J) to enter the incremental find mode, and start typing the string to match. Matches are found incrementally as you type. The search string is shown in the status line. Press Ctrl+J or Ctrl+Shift+J to go to the next or previous match. Press Enter or Esc to exit incremental find mode.
If you'd like to have search functionality in a toolbar, you may be interested in the eclipse-glance plugin, which allows you to use the incremental search function in a toolbar by pressing Ctrl + Alt + F while in any text area.
This feature is already available in eclipse. No need to install any plug-in.
Press Ctrl+F, and the Find pop up appears.
Now check the incremental checkbox, and then your texts will be found as you type. No need to hit return.
OR
Use Ctrl+J and you can activate the live search, just that there wont be any UI visible, but you can see the status in eclipse status bar at the bottom.
Press Ctrl+J, start typing the text you want to search for. Press esc to go back to edit mode
The closest thing to the functionality you are asking about is the 'incremental search' mode, which is triggered by checking the 'Incremental' checkbox in the Options group on the Find/Replace dialog in Eclipse (Ctrl+F from the code editor). This will make it start highlighting matches as you type, and if they are keywords, Eclipse will highlight other occurrences (references) in the code editor. Matches inside strings or Javadoc will not be highlighted, however, unless it happens to be the first match after your cursor's position inside the editor.
One similar thing (not the same) is just enabling "mark occurences", then selecting function name, variable etc.

Is it possible to dock the "Find/Replace" window in Eclipse?

I could have sworn I saw it once before in a screencast where someone had the find/replace window docked in their Eclipse environment.
However looking through the list of options in "Window > Show" the closest thing I can find is the Search window.
I find that I use it quite a bit and with larger monitors these days I figure I could afford to have it open in my perspective all the time.
Is this possible?
Thanks.
One poor-man's workaround is to dock a view that you don't need in a part of Eclipse where you want the find/replace view and then place the find/replace dialog on top of that like this:
Clearly this is a huge kludge but it does work.
I am not sure about that, since Fast views are:
icons allowing users to quickly display different views that have been created as fast views
And the search/replace is a Dialog, not a View..
(source: bpsite.net)
(That Dialog box is not like Views, which support editors, also have their own menus. Some views also have their own toolbars.)
The help page mentions:
Fast views are hidden views that can be quickly opened and closed. They work like other views except they do not take up space in your Workbench window.
This might not be an exact answer for the question. But this works like a charm.
Press ctrl + j and keep typing...
Use ctrl + k to go on
Use shift key wherever required.
Use Edit > Incremental Find Next (Ctrl+J) or Edit > Incremental Find Previous (Ctrl+Shift+J) to enter the incremental find mode, and start typing the string to match. Matches are found incrementally as you type. The search string is shown in the status line. Press Ctrl+J or Ctrl+Shift+J to go to the next or previous match. Press Enter or Esc to exit incremental find mode.