Searching files in Eclipse - eclipse

I want to search a file in Eclipse. What's the shorcut to open file search dialog box?

If you want to search in files: Ctrl+H and then choose tab File Search.
If you want to search for resources: Ctrl+Shift+R.
If you want to search for Java types: Ctrl+Shift+T.
If you want more shortcut keys: Ctrl+Shift+L.

There is no default shortcut to open the "Search a File" dialog directly.
Anyway you can use CTRL + H to open the "Search Dialog".
You can also use CTRL + Shift + L to open the "Key Assist" which will show you all configured shortcuts as a kind of tooltip.
Pressing again CTRL + Shift + L in the "Key Assist", you can directly configure your own shortcuts. Enter "File Search" for the filter and simply set your own key combination.
I often search for a file and want also to open it directly. So I use the "Search for Resource" Dialog called with CTRL + Shift + R.

Use the Window->Preferences menu and select the General-Keys tab to see and change any key binding.
Shortcut for this: Press two times CTRL + Shift + L

There's also a plugin called MouseFeed that shows all keyboard shortcuts for the menu operations you do. You could even set it to prevent you from using the menu alternative and force you to use the shortcut.
A good way to help you become quicker at using Eclipse.
Edit: The domain associated with the plugin seems to be gone now and replaced with a porn site. So at this point the status of the plugin is a bit unsure :)

Related

Visual Studio Code - Shortcut - Collapse all files in explorer

Can you anyone provide the shortcut for collapse all files in visual studio code explorer?
I personally prefer not to create new shortcuts. As #Mark pointed out on the answer of #JayChase there is an existing shortcut, but it requires the explorer to be in focus. Therefore I combine the shortcut mentioned by #JayChase with another standard shortcut, to get the desired behaviour.
command + 0 (focusses on explorer).
command + left-arrow
An additional benefit over this approach is that I usually want to focus on the explorer view if I want to collapse the folders.
Open the Keyboard Shortcut by pressing Ctrl + K then Ctrl + S and search for Collapse, you will see the Collapse Folders in Explorer key binding (It is empty by default). Press the + button to add your desired key binding.
Now you can enjoy your shortcut.
it's cmd/ctrl + shift + up-arrow
You can collapse all folders using cmd/ctrl left-arrow.
First, click anywhere in the explorer window to activate it, then use the shortcut.
On Windows and Linux.
Ctrl + Left arrow
On Mac:
⌘ + Left arrow
When the Explorer is active, you could use the Workbench list based shortcuts. list based shortcuts include collapse, collapse all, expand, expand all, toggle expand/collapse
To see what are the shortcuts open Keyboard Shorcuts -> Search for list. . Here you find shortcuts for collapse, collapse all, expand, expand all, toggle expand/collapse. These shortcuts work when the Explorer is active, as the Explorer works as a list.
Below is a screenshot for Mac.
If you would like to define a shortcut, without activating the Explorer, then I would recommend - cmd+k ctrl+c. You could add this by opening Keyboard Shorcuts -> Search for Collapse Folders in Explorer -> Click the edit button after hovering over the the Command you want to edit.

Eclipse Short Cut: File Search

I have looked and looked but I cannot find a shortcut for "File Search" in Eclipse.
I even downloaded the mousefeed plugin. (It is pretty cool whenever you do something with the mouse. A little popup comes up and tells you how you could have done that with a shortcut. Not super useful but somewhat useful.)

			
				
ctrl + H opens the search dialogue box. Click on customize and check the option 'Remember last used page'. First time you have to select the tab file search and perform a search. After that if you press ctrl + H , it will automatically point to file search tab.
There is none, but if you go to Windows - Preferences - General - Keys, and type File search in the filter text box, you'll then be able to select the File search action, and type your own key binding.
You can change all shortcut keys in eclipse for instance:
Window -> Preferences -> General -> Keys -> search: File Search -> Binding -> *what ever key combination you like.

Is there a "Find in Files" shortcut in Eclipse?

Is there a "Find in Files" shortcut in Eclipse, as there is in Visual Studio (Ctrl+Shift+F)?
I have looked in these two lists:
Eclipse Shortcuts
"Show All Shortcuts" shortcut: Ctrl+Shift+L.
Thanks.
select workspace and press Ctrl-H
Which dialog is selected, depends on which file type is selected in the Project Explorer view. For example, if you selected a .js file and press Ctrl-H, it will bring up the dialog with the "Javascript Search" tab selected. If you want to search all files, you can press Ctrl-F7 to select the Project Explorer view, use arrow keys to select a folder above your files, then press Ctrl-H (or select a file, whose type doesn't trigger a custom dialog tab).
Thanks to the other two solutions, but here is the complete answer I was looking for, which addresses how I search all the text within the files, not just types, methods, packages, constructors, and fields:
Ctrl+H to open the "Search" dialog box
"File Search" tab, if it does not appear, expand the window or use the left/right arrows
type in the text to search for
Use "*.java", in my case since I am coding in Java, to search just these files
Click "Search"
If you are using only the File Search, you can Disable all other Searches in the Search Panel (Customize... lower left Corner). Then you have the File Search everytime you Press Ctrl+H
Ctrl+H to bring up the search box
Click 'Customize' in the lower left
Checkmark 'Remember last used page'
Click OK.
Select the file search tab and do a search
If you want to use the type-specific search (Java, Javascript ...etc) you can use Ctrl+H, which opens the search dialog, then click the Search button.
If you simply want to search for all text occurrences in the whole the workspace click the word (or select the text) you want to search then hit Ctrl+Alt+G. You will directly get all the found occurrences without even using a dialog box.
I find Ctrl+Alt+G is the best solution because it shows the variable name in different by related files (e.g. Java and XML, or Javascript and HTML) while still having the type-specific search feature available through Ctrl+H
You can rebind the Ctrl+Alt+G to finding text in a project or a working set instead of the whole workspace if that's more appealing to you.
Yes, there is shortcuts for searching Eclipse, these shortcuts are very useful when we search for particular html, jsp , xml, java, properties ,class, jar,search file with keywords.
Ctrl+H is used open Tag, in that you can select type of file Remote Search, File search, git search, java search, javascript search , etc
Ctrl+Shift+R is used to search all files in the current project
Ctrl+Shift+T is used to search all files in the workspace
press Ctrl + H . Then choose "File Search" tab.
additional search options
search for resources press Ctrl + Shift + R
search for Java types press Ctrl + Shift + T
Source: Eclipse: Default to "File Search" Tab in Search Dialog
Go to your key bindings Windows > Preferences > General > Keys
Unbind the Shorcut "Ctrl+H" for the "Open Search Dialog"
Filter/Search for "File Search" and use the "Ctrl+H" here instead.
I believe adding plug-ins power your needs.
If you install Plug-in named InstaSearch it makes your searching faster inside current active working projects.
It shows the result as you type.
http://marketplace.eclipse.org/content/instasearch#.VIp-_5_PGPQ
As pointed out, CTRL + H opens the Search dialog.
Since I use only Find in Files (and set File name patterns when needed), I clicked on Customize... button on the bottom of the Search dialog. It opens Search Page Selection dialog, where I turned off all other options.
You can also click on Remember last used page in the same dialog.
Ctrl+Alt+F (Find Text in Project -Customized Key)
Note - Ctrl+Alt+G is for Find text in a workspace, not in a project
How to customize this Key
Window->Preferance->General->Keys-> Search for 'Find Text in Project'->Type 'Ctrl+Alt+F' in binding ->Apply
Note - this will be helpful if the developer is working on multiple project simultaneously.

Is there a shortcut for switching between panels in eclipse?

Eclipse has an MDI structure (Multi Document Interface), so the search panel, the package explorer and the code editor can all be open in one window, but I haven't found a keyboard shortcut for switching between these panels. For example, after I search the code-base, I would love to have a quick shortcut for going back to the code editor.
If I understand your question correct, you are probably looking for Ctrl + F7 and Ctrl + Shift + F7. Other navigational shortcuts can be found in the menu: Window > Navigation.
Not an universal shortcut for going to any panel, but:
Ctrl+Shift+E
allows you to go back to any Editor (although it's still a little heavyweight for quick editor navigation).
And if you want to switch between perspectives its: Crtl + F8 and Ctrl + Shift + F8. You can go to Help > Key Assist... for a full list of shortcuts (this list will change depending on the active editor etc.).
There are two ways to do it.
One is how #VonC did it, in an earlier reply; using CTRL+SHIFT+E which opens a box containing all the panes with their paths.
The other one is to simply use CTRL+E, which will open a pop-up just over your cursor containing the list of panes open. Parse using arrows and ENTER

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.