简体   繁体   中英

Eclipse keyboard shortcuts for compare/diff view?

When I am comparing two files in Eclipse (using, for example, "Compare With" --> "Local History"), what keyboard shortcuts are available?

I would like to be able to go to the next/previous diff and copy the selected diff left without having to click the tiny little buttons.

Thanks!

To complete Artem 's answer , after Preferences->General->Editors->Keys , search for:

  • Select next change
  • Select previous change
  • Copy from Left to Right
  • Copy from Right to Left

All those keys in the " Compare " section have no shortcut assign by default, so you can add the ones of your choice.

http://rubenlaguna.com/wp/wp-content/uploads/2007/08/comparebefore.png

Set your own keys as instructed by @Artem and @VonC.
In Eclipse Galileo, however, the path is Window > Preferences > General > Keys .

For each command you wish to set:

  1. Click on the Command Name
    TIP: Sort by "Category" to group all "Compare" commands.

  2. Click on the "Binding" textbox
    Then, select the keys you wish to use, Eclipse will record them for you.
    TIP: You can enter a sequence of keys in addition to key combination(s).

  3. Set "When" drop down box to "Comparing in an Editor."
    TIP: This setting will limit your hot key(s) to only be activate in the chosen context.


Intuitive Hot Key settings: (my recommendations, not from a standard)

  • Copy All from Left to Right Ctrl+Shift+Left , Ctrl+Shift+Right
  • Copy All from Right to Left Ctrl+Shift+Right , Ctrl+Shift+Left
  • Copy from Left to Right Ctrl+Left , Ctrl+Right
  • Copy from Right to Left Ctrl+Right , Ctrl+Left
  • Select next change Ctrl+Down
  • Select previous change Ctrl+Up

With eclipse, when you are in a window and you have a button to do a action but this button doesn't have a tooltip to show you his shortcut, go to Navigate menu. The most of time, shortcuts are shown there.

在此输入图像描述

Actually you can define whatever you want to be a short cut for this. Preferences->General->Editors->Keys. EDIT: For some reason I don't see that option appears there. O_o

There is a catch. There are no Next Difference and Previous Difference entries in the key bindings editor. These two buttons in a compare window are bind to Next and Previous entries in the key bindings editor. See Is there a key binding for Next Difference and Previous Difference in Eclipse Compare Editor?

I raised a bug at https://bugs.eclipse.org/bugs/show_bug.cgi?id=401129 which can be voted on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM