How to enable "live search" in eclipse? - 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.

Related

VSCode how to automatically insert Intellisense suggestions without having to press Enter?

Default VS Code Intellisense behaviour
User is presented with a menu of suggestions
User then has to press the Up or Down arrow keys to navigate through the menu
Finally user has to confirm with Enter to insert the suggestion and close the dialog
What I would like instead
Don't need to press Enter
Suggestions are automatically inserted (and cycled through) by pressing Up/Down
Pressing any other keys will close the dialog and resume typing
To be clear, I want to replicate the default behaviour of YouCompleteMe:
When you type, a completion menu pops up. If you like the completions, you use the <Tab> key (by default, can be changed to <Enter> or <Down> arrow or whatever) to select a completion string you want. The very act of "tabbing through" the list to select the item you want inserts the candidate string. When you tab to a different candidate, the editor code is replaced with the new candidate. There is no accept key because by the point where you have the candidate you want selected in the menu the candidate has already been inserted in the editor. There is nothing to "accept". You just keep typing, the candidate has already been inserted.
Is such behaviour possible with Visual Studio Code, either by default or through a plugin?
The editor.tabCompletion option is the closest thing currently available:
By default, tab completion is disabled. Use the editor.tabCompletion setting to enable it. These values exist:
off - (default) Tab completion is disabled.
on - Tab completion is enabled for all suggestions and repeated invocations insert the next best suggestion.
onlySnippets - Tab completion only inserts static snippets which prefix match the current line prefix.
(Emphasis mine)
... except that the first Tab press hides the suggestion window.
I did some digging about editor.tabCompletion, and I found that closing the suggestion window is part of the tab completion's option original design, and that while other users have asked about an option not to close the suggestion window or specifically YouCompleteMe-style behaviour, that this is currently not supported.
"editor.acceptSuggestionOnEnter": "off",
To disable Enter to accept suggestion.

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.

Search box in Eclipse

When I hit Ctrl+F in Eclipse, it would bring up a search-box asking for the term, etc.
That's annoying because if I'm on a small monitor, the pop-up would cover most of the text.
Does Eclipse have a search-bar at the bottom (or top) of the editor like Netbeans does?
(In Netbeans, when you hit Ctrl+F, a very small search-bar would appear at the bottom/top of the editor).
You can use Increment find for this. Press Ctrl+J.
Then observe in the status bar THAT incremental find is activated. Then you can go on typing your search term the first occurrence of word will be highlighted in editor if found else you will get <search term> is not found error(in red colour) in status bar.
Refer the image below
Note:
You can cycle through forward the next occurrences by pressing Ctrl+K and backward by pressing Ctrl+Shift+K
If the shortcut key for incremental find is NOT working then check the short cut keys for Increment Find and Reverse incremental Find commands in
Windows->Preferences->Keys section

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.

How do I hotkey directly to File Search tab in Eclipse

When I use CTRL+H I end up on the Java Search tab. I would very much like a shortcut to go directly to File Search instead. Is that possible?
See image here for what I'm talking about:
You can just define a key binding that opens the file search:
Go to Preferences > General > Keys
Type "file search" in the search box. (If there are no results, and you have a really old Eclipse version, select the Include Unbound Commands check box.)
Put the caret into the Binding text box and press the key combination you want to use:
You can either re-use the CTRL+H binding (delete the other binding in that case) or define another one (e.g. CTRL+SHIFT+H). To delete the other binding search for "Open Search Dialog" and click on Unbind Command.
Other solution: You could press CTRL+3 in your editor, type in "file s", press Enter. The next time you press CTRL+3 "File Search" is at the top.
Another option is to open the search dialog (Ctrl+H) then click customize and hide java and task search tabs, next time you do Ctrl+H, file search will be the only one showing, thus it will be selected by default
I actually think the best (and easiest way) is to simply open the search dialog (ctrl + h), hit customize, and then select the checkbox for "Remember last page used." Then tab over to the File Search once. So long as that is the last search tab you used, it will always open there. The advantage to this is that you don't lose easy access to the other tabs, should you actually need them! (working in Eclipse Kepler).
I learnt to use a "pseudo-hotkey" ALT+A F (works also as ALT+A ALT+F), which resolves to: "Menu Se[a]rch → [F]ile..." and has the advantage of being always present, without need for reconfiguration.
I've run into this problem before, too.
I tried following the advice in the question response given by #Martin to rebind Ctrl+H to "File Search" in Window | Preferences | General | Keys, but for some reason, I don't have a "File Search" entry in the Command column. (I'm running Eclipse 3.3 currently; maybe the "File Search" entry was added in a subsequent release?)
Update: As Martin pointed out in a comment on this answer, I didn't have the "Include unbound commands" checkbox checked in the Preferences | Keys dialog, which is why "File Search" wasn't showing up for me. I now have Ctrl+H bound to "File Search", as Martin suggested in his answer on this page, and it works great. Thanks Martin!
I ended up working around the original problem by bringing up the Search dialog with Ctrl+H, then clicking the Customize button on the dialog, which brings up a "Search Page Selection" dialog which allows you to hide or show tabs on the Search dialog. I hid the tabs other than "File Search," which causes "File Search" to be activated by default on future uses of Ctrl+H.
As far as I know, the search window tab depend of the open file you're on when calling the search function. So, for example if your on a web.xml file, it will open the "plug-in search" instead of the "java-search".
Edit: there is a way to force the default open tab, by assigning a shortcut to the "File Search" action in the "Keys" preference panel.
Probably this feature came recently [confirmed its there in since Juno] and looks intelligent.
Press Ctrl+H --> Customize --> [Checkbox] Remember last used page.
This way you are not far from other options if required anytime. So if you use File search often then you will not get annoyed getting what you last chose.
I would like to provide a workaround here:
you can 'remember last used page' to avoid opening it over and over again.
UPDATE: user #muescha, in the comments underneath the question, just pointed out to me that I accidentally answered the wrong question! Nevertheless, it is still a valuable answer (just not to this question), so I'm leaving it.
My answer answers the question: How do I use a hotkey directly to search for a File in Eclipse?
Ctrl + Shift + R works fantastically! Use asterisks (*) for wildcards. It is very similar to the Ctrl + P fuzzy search in Sublime Text 3.
Sample searches using the Ctrl + Shift + R "Open Resource" search in Eclipse:
rea
*.txt
*32*f1*c
*3*1*c*h
Notice if you just put an asterisk * between every character in the search string it works just like Sublime Text 3's Ctrl + P "fuzzy search"! Beautiful!
Side note: you can also use the Search --> File menu dialog to search for files.