Export and Import custom key bindings in Eclipse

This note relates to Eclipse 3.6.0

Eclipse saves a user’s preferences in a special area of the workspace directory. In fact, it saves all the information in the sub-directory called “.metadata”. If you use multiple workspaces or need to create a fresh new workspace, when you first start the workspace, you will find out that all the key bindings and other preferences are lost. Copying the “.metadata” directory between two workspaces is not an option since it also contains the information about the projects.

The process needed to copy the user’s preferences between two workspaces is to export them from the workspace containing the favoured ones, and importing them in the desired workspace. In the process, Eclipse produces a text file with an “.epf” extension which can be used to port the preferences between workspaces.

To produce the exported preferences file, use the Eclipse menu:

  • File > Export… > General > Preferences > Next
  • At this page, select what should be exported. For exporting only key bindings, unselect “Export All” and check “Keys Preferences”
  • Specify a file to save the preferences to
  • Press “Finish”

To import the preferences file, using the Eclipse menu:

  • File > Import… > General > Preferences > Next
  • Browse for the desired preferences file
  • Click “Finish”

Although there exists, in the preferences page where key bindings are assigned, a button offering to export key bindings in a CSV file, I do not know how to use the produced CSV file restore key bindings in the different workspace. The .epf method, described above, is the only one I know, so far.

One Reply to “Export and Import custom key bindings in Eclipse”

Leave a Reply

Your email address will not be published. Required fields are marked *