How do I hotkey directly to File Search tab in Eclipse
Asked Answered
F

9

116

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: enter image description here

Folium answered 18/9, 2008 at 12:17 Comment(0)
C
147

You can just define a key binding that opens the file search:

  1. Go to Preferences > General > Keys
  2. 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.)
  3. Put the caret into the Binding text box and press the key combination you want to use:

enter image description here

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.

Cyzicus answered 18/9, 2008 at 12:31 Comment(1)
I initially didn't notice that my "When" dropdown at bottom was defaulted to "Browsing attached Java Source" -- I had to change it to "In Windows" (as shown in your diagram) for it to pick up.Lawyer
U
49

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

Ungrateful answered 20/12, 2010 at 18:24 Comment(1)
Much better option, sending "java search" to it's proper place!Astera
B
18

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).

Customize view

Boothe answered 31/7, 2014 at 20:0 Comment(2)
Not present in older eclipse i believeMcgehee
This works great for me; Eclipse Version: Mars Release (4.5.0) Build id: 20150621-1200Johathan
A
11

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.

Alenealenson answered 31/10, 2013 at 20:38 Comment(1)
This is useful/faster as it's easier to type with one hand than Ctrl+H is. Nice!Ingraft
K
2

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.

Knowling answered 18/9, 2008 at 13:15 Comment(3)
Did you click on "Include unbound commands"? Otherwise you wont get that entry!Cyzicus
@Martin, that was it exactly -- I didn't have "Include unbound commands checked." "File Search" did show up in the list after I checked it. Thanks for your help! :-)Knowling
This is not really an answer but rather a series of comments. In the end, there is an answer, but the same answer is given in a much more concise form in Enrique's answer. IMHO, this answer can be deleted.Academic
W
1

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.

Welt answered 18/9, 2008 at 12:24 Comment(1)
Im always somewhere in the project explorer when pressint CTRL+hFolium
A
1

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.

Abbeyabbi answered 30/10, 2015 at 4:24 Comment(2)
Even though your answer repeats others, since it was too verbose I skipped through them and the 'Customize' in your answer caught my eye so I upvoted. Try as I might, no amount of unbinding and binding would make Ctrl+Shift+F work for this (File Search), finally Assigning Alt+S did the trick. Wish I had seen this answer prior to all that ! Eclipse need to smarten up and realize people may not only use this for Java and even in Java development we seldom use the crappy Java Search. Everyone I know uses File Search by default. Gone are the other cbs :)Presbyterate
@Presbyterate Sure editing the contents based on your feedbackAbbeyabbi
H
1

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.

This answers an adjacent 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

enter image description here

*.txt

enter image description here

*32*f1*c

enter image description here

*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!

enter image description here


Side note: you can also use the Search --> File menu dialog to search for files.

See also

  1. My document: Google Docs: Eclipse setup instructions on a new Linux (or other OS) computer - search it for "4 find shortcuts".
Herrera answered 22/3, 2018 at 19:35 Comment(0)
C
1

I would like to provide a workaround here: you can 'remember last used page' to avoid opening it over and over again.

enter image description here

Concordia answered 3/5, 2018 at 7:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.