Anyone know the keyboard shortcut to copy/paste a line into a new line in Eclipse
, without having to highlight the entire line?
ctrl-alt
The Ctrl+Alt+Down / Ctrl+Alt+Up flips my screen so I overrode that in the Eclipse shortcuts via Window => Preferences => General => Keys. Search for "dupl" to find the Duplicate Lines command. I overrode the default and chose Ctrl+Shift+D. For me, that's easy to remember just like Ctrl+D to delete lines
The advantage over Ctrl-Alt-Down followed by Ctrl-X suggested by other users is that it doesn't make eclipse think that the file was changed in any way. It's also faster and causes no problems even if the user has rotating screen issue with Ctrl-Alt-Down/Up keyboard shorcut. So there's no need to remap shorcuts for this.
Another way to go would be hitting Alt-Shift-Up until the entire line gets selected. If you've gone too far, of course you can select less with Alt-Shift-Down.
On my Mac the default setting is is ALT+CMD+Down
You can change/view all key bindings by going Eclipse -> Preferences (shortcut CMD+,) and then General -> Keys
If anyone using Mac computer the CTRL + ALT + DOWN keys doesn't work.
Try it with,
ALT + COMMAND + DOWN
It works.
On Mac, I've tried the linecopypaste and it works great cmd+c -> Copy current (unselected) line, just like "yy" command in Vi/Vim cmd+v -> Paste it, like "p" command in Vi/Vim
Thank's Larsch for your work!
PD: Using Eclipse Luna 4.4.2 in Yosemite
To copy text from the begining of line to the cursor position: ctrl + insert
It does the job and save a lot of time for me.