Eclipse keyboard shortcuts for compare/diff view? - eclipse

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.

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:
Click on the Command Name
TIP: Sort by "Category" to group all "Compare" commands.
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).
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.

Related

how can I select non-first suggestion use keyboard in vscode?

I want to use vscode with out mouse,purely.When I press F1 to run some command or something else that can launch a drop-down suggestion list,it`s inconvenience to move up and down by arrow keys.So,my question is:Is there any way to set a key that can select one of the candidates immediately,like alt 1~9?
Not sure about selecting one of the candidates immediately, but you can rebind the up and down arrow keys to something like alt+j and alt+k that's closer to the home row.
Go to keyboard shortcuts via ctrl+,
Then search up workbench.action.quickOpenSelectNext, double click the entry and type your desired keyboard combination. Repeat for workbench.action.quickOpenSelectPrevious.

vscode deselect one from "change all occurrences"

In VSCode working in a file, and you need to change multiple variable etc.
When selecting all occurrences in a file,
I often find that I need to de-select one or more,
can you do that?
On Mac, to de-select one or more substrings selected with Cmd + D, type Cmd + U.
Analogously, type Ctrl + U on Windows/Linux.
Found on https://www.reddit.com/r/vscode/comments/8gx98z/how_cancel_last_ctrld_selection/
Assuming you use Ctrl+D to select multiple variables, press K while still holding Ctrl to skip/exclude the current selection.
You can use your multi-cursor add command to also de-select specific cursors. So if you have this setting:
Editor: Multi Cursor Modifier
The modifier to be used to add multiple cursors with the mouse. The Go
To Definition and Open Link mouse gestures will adapt such that they
do not conflict with the multicursor modifier. Read more.
set to alt (the default) then you can alt+left-mouse-click them in any order to deselect them. Or same with Ctrl/Cmd if that is your setting option.
If you use the find widget to find all your occurrences (select a word and Ctrl+F) then alt+enter will select them all from the start. Then you can deselect any of them with the alt+left-mouse-click thing. and then if you want them all reselected for any reason alt+enter will do that.
See demo for both methods (right-click vs find widget).

How to autocomplete curly braces and move cursor into it automatically in Eclipse?

I am new into Eclipse. I found that when I type Ctrl + ( it will also generate ) automatically, and move the cursor into this pair at the same time. After I finish editing coding in the pair, the cursor will jump out the parentheses automatically when typing Ctrl + ).
It's very convenient because I don't need to take a long distance movement to operate the arrow keys with my right hand every time. I also found [] also has this functionality. Unfortunately, I still don't find any combine-keys with {} to perform this functionally. Does anyone know about it?
First, look on Eclipse jump to closing brace.
Open in Eclipse Preferences from menu Window.
Navigate on left side to Java - Editor - Typing.
There is the option {Braces} in the group Automatically close. Check this option.
Also in Preferences navigate to General - Keys.
There is in the list the command Go to Matching Bracket with Editing Java Source in column When. You can redefine the key binding of this command.

Eclipse CDT : C++ Editor window, select word under cursor?

I am using Eclipse after coming from a well known commercial IDE. I am struggling with a very simple user requirement.
I want to search for the word under the
cursor with one key press!
The only way I know to select the element at the cursor is mouse double click. CTRL-LEFT/RIGHT, moves the cursor to start/end of the current word, with a SHIFT selecting as it goes. This means you need to CTRL-LEFT, CTRL-SHIFT-RIGHT - CTRL-K to do a search.
So if I can map the double click functionality to a keyboard key, my problem is solved - "Mapped Key" + CTRL-K.
The menu option Edit | Find Word does what you want. It doesn't have any keybinding by default, but you can add one in Window | Preferences, General -> Keys

How to highlight the selection in Emacs keybinding of Eclipse?

I have searched the Web for this, but with no luck. Any idea?
Thanks.
Try using the Emacs+ plugin available here:
http://www.mulgasoft.com/emacsplus
It provides a HUGE range of functionality - including the selection highlighting that you're looking for - that really helps the move from Emacs. I've only been using it for a couple of days, but it appears stable and integrates very well with the editor.
As described here, you can set emacs key binding to work in component editor in Eclipse
Go to Preferences -> General -> Keys.
Change Scheme to Emacs if you haven't done so already, so you can easily
spot the emacs key bindings.
Sort by Category and look at the "Text Editing" categories
Find the commands that you care about, e.g. Next Column, Previous Column
Select that command and click "Copy Command"
Set the binding to the key by pressing the keys, e.g. press Control-f to
generate "^F".
Change "When:" to "Editing Components".
Repeat for all the key bindings you care about.
So if, in emacs, selection is done by setting the mark (Control-Space) at the start of the region, then moving the point to to the end of the region, you could associate the appropriate shortcut to:
Text Editing > Select Text Start
Text Editing > Select Text End