13

I'm trying to switch to Eclipse from my other IDE and everything works fine so far except for the problem described in the title.

In my previous IDE (Idea) I would position a cursor on a line, press Ctrl+C and the whole line would go to clipboard (if nothing is selected).

Is there any way to copy the whole current line of code to a clipboard with a single shortcut in Eclipse? I.e. without pressing Home twice, then Shift+Down, and then Ctrl+C?

PS JIC: I don't want to duplicate current line up or down - I know how to do that.

Oleg Mikheev
  • 17,186
  • 14
  • 73
  • 95
  • http://stackoverflow.com/questions/2321938/eclipse-copy-paste-entire-line-keyboard-shortcut brings up https://github.com/larsch/eclipse-linecopypaste which should do what you want. – yhyrcanus Jul 11 '12 at 17:52

4 Answers4

6

Try the Windows/Preference->Keys dialog, if you cant find what you are after, you can always define your own...

You could also try taking a look at this, which does exactly what you expect from ctrl+c without a selection http://code.google.com/p/copycutcurrentline/

Blueberry
  • 2,211
  • 3
  • 19
  • 33
6

Do a triple mouse click to select the line, then CTRL+C for the copy operation.

Simon Dugré
  • 17,980
  • 11
  • 57
  • 73
Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
  • Now I would really like to know the reasons for downvoting, as that answer is perfectly valid... – Bananeweizen Sep 28 '12 at 06:27
  • 4
    it is valid but he didn't ask that, he ask how to copy entire line to clipboard without selecting a line...similar to ctrl+d (erase current line) but for copy – dev_in_progress Jul 08 '15 at 07:29
  • I'm reading the question as "How to do it more easily than..." instead of "Avoid selection at all cost". – Bananeweizen Dec 26 '16 at 12:50
  • Personnaly, I use shortcuts in order to use mouse the less as possible, thus, triple clicking is not the way I searched for, tough it works. This is maybe the reason for downvotes. – el-teedee Mar 15 '17 at 12:59
5

You can use Vrapper to integrate the power of Vim into edting with Eclipse:

"+yy

copies current line into clipboard in Vim :)

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
MD. Mohiuddin Ahmed
  • 2,092
  • 2
  • 26
  • 35
3

Press ALT+SHIFT+UP to increase the selection. After a couple of times the whole line will be selected and then you can copy it.

Simon Dugré
  • 17,980
  • 11
  • 57
  • 73
hbhakhra
  • 4,206
  • 2
  • 22
  • 36