^H(eaven) key binding in Eclipse

Eclipse File Search WindowAs a long time user of Eclipse, I have never understood the any of the tabs of the Search panel in Eclipse. JavaScript search, Java Search, Remote Search, they all make no sense to a modern man who is used to a single search box which searches everything. So I always use the “File Search” Tab, which does exactly what I want 99% of the time.

File Search always requires mouseclicks. To open the Search window and select the correct tab. It was not until recently that I realized that I could actually reassign the ^H (Control – H) key combination to pop up the File Search tab. If you are an avid Eclipse user you’ve probably already done this, or know how to do this. If you are new to eclipse, or lazy like me, read on to see how you can re-map this key binding.

To remap ^H to “File Search”, do the following:

Open Eclipse preferences and go to “General -> keys”. You should see the following settings screen:

Eclipse Key Bindings Preference page

  • In the filter text, type “file search”. The command list should now contain only one entry, “File Search”.
  • Highlight the “File Search” command
  • Click in the “Binding” field and press ^H. You should now see that you’ve created a conflict with the “Open Search Dialog” in the “conflicts” list on the right.
  • Select the conflict you want to remove, and empty the key binding field.
  • Press the “Ok” button to close the preferences screen.

Now you’re all done. When you’re in an editor and want to see if selected text is present in other parts of your project

Let’s say you are looking at Java source of an Ibatis SqlMapClient and want to find the matching statement in any of the the SqlMap.xml files. You can now simply select the text in the Java file, hit ^H, Enter, and voila, you get a list of all files with that same text in it, anywhere in your enclosing project or workspace, without copy-pasting or even touching the mouse.

Now go play with your new found piece of heaven.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s