[java] Eclipse copy/paste entire line keyboard shortcut

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-down turns my whole screen upside down (I'm on windows). Interestingly, that's what's specified in the windows->preferences.

This question is related to java eclipse copy keyboard-shortcuts paste

The answer is


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


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


Ctrl+Alt+Down Copies current line to below like notepad++ (Ctrl+D)

If your whole screen is 180° rotted then you should disable your hotkey settings.

Right Click -> Graphics Options -> Hot Keys -> Disable

enter image description here

That it now you done try shortcut Ctrl+Alt+Down


Just another approach:

1) Alt+Up and Alt+Down (or Alt+Down and Alt+Up, order does not matter)
2) Ctrl+C

But of course vim's "yy" is the fastest :)


If anyone using Mac computer the CTRL + ALT + DOWN keys doesn't work.

Try it with,

ALT + COMMAND + DOWN

It works.


ctrl+alt+down/up/left/right takes precedence over eclipse settings as hot keys. As an alternative, I try different approach.

Step 1: Triple click the line you want to copy & press `Ctrl`-`C`(This will
select & copy that entire line along with the `new line`).
Step 2: Put your cursor at the starting of the line where you want to to paste
your copied line & press `Ctrl`-`V`.(This will paste that entire line & will
push previous existing line to the new line, which we wanted in the first place).

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.


  1. Ctrl-D would delete a line
  2. Ctrl-Z would undo deletion, with highlithing entire line
  3. Ctrl-X/C cut or copy entire line

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.


For personal usage, I add a vim plugin like Vrapper to Eclipse and just use yy to copy entire line.


Another shortcut way to do this is press Ctrl+Shift+L and select which command you want to perform and hit enter enter image description here

its best practice for beginner.


It's working with me on , Eclipse + Spring tool suite .

ALT + COMMAND + DOWN


Disabling the hot keys for the Intel Driver worked for me for Windows 7. However, for Windows 8, when I tried that, it prevented eclipse from getting the Ctrl-Alt-Down keystoke. I had to change the Intel driver key binding to Ctrl-Alt-F10 (or something else it will accept). Eclipse then gets the Ctrl-Alt-Down and copies the line.


Try this in MAC.

ALT + COMMAND + DOWN

it works.


You have to turn off the graphics hot keys that flip the screen. If you're on Windows, you need to right click on the Windows desktop and select "Graphics Properties..." (or something similar depending on your version of Windows). This will bring up a screen where you can manage graphics and display options, look for a place where you can disable hot keys, sometimes it's hidden under something like "Options and Support". Turn off the CTRL + ALT + ? and CTRL + ALT + ? hotkeys (alternatively you can just disable all graphics hot keys if you're not using them).


If you want to copy a line to the clipboard you can also use the trick:

Ctrl-Alt-Down followed by Ctrl-X

The drawback is that the file where you copy the line from becomes dirty.


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 combination of Ctrl + Shift + Alt + Down worked for me on Linux.


We can assign any command to any action(given) in Eclipse From Menu Bar go to Window > Preferences then search for the keys then search copy line then click on copy line and then click on command in Binding and peform a command which you wish to use for duplicating line i use ctrl+shift+d you can choose whatever you want enter image description here


I have to change the assigned key, e.g.

Windows/Preference --> General --> Keys

Select "Duplicate Lines" under command Click on "Binding" Ctrl + Shift + D


If Your Window pc, you may try this, it's also for STS:

Ctrl + win + Alt + Down :: Copy current line or selected line to below

Ctrl + win + Alt + Up :: Copy current line or selected line to above


(Tested on Windows) [Per below comments, works as well in Ubuntu, IBM RTC 4 / RSA 9]

  1. In Eclipse, press Ctrl+Shift+L two times in succession (or Ctrl + 3 > type: Keys > Enter).
  2. In 'type filter text' (search) text box, type Copy Lines
  3. Select the filtered row, right click the 'Binding' field, and do Select All
  4. Press Ctrl+Shift+V
  5. Give OK

From now on, for any line you want to duplicate, just press Ctrl+Shift+V.


I am using Windows 7. To disable that all I did is to Right click on the Windows desktop and select "Graphics Properties" ->Options. Then selected "Off" at the left side on the resulting screen. This disabled all hotkey combination. I think there is no way to disable only some them, its all or none. Anyway I didn't need them. So now crtl+Alt+Up and Crtl+Alt+down works for me in Eclipse and my screen stays same :) I think similar option also exist in other versions of Windows. Have fun :)


I've written the linecopypaste plugin for Eclipse that mimics Visual Studio's copy/cut/paste behaviour. I've also found copycutcurrentline which appears to do the same.


For mac, shift+alt+down_arrow works in netbeans' editor.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to copy

Copying files to a container with Docker Compose Copy filtered data to another sheet using VBA Copy output of a JavaScript variable to the clipboard Dockerfile copy keep subdirectory structure Using a batch to copy from network drive to C: or D: drive Copying HTML code in Google Chrome's inspect element What is the difference between `sorted(list)` vs `list.sort()`? How to export all data from table to an insertable sql format? scp copy directory to another server with private key auth How to properly -filter multiple strings in a PowerShell copy script

Examples related to keyboard-shortcuts

Collapse all methods in Visual Studio Code Is there a keyboard shortcut (hotkey) to open Terminal in macOS? Jupyter/IPython Notebooks: Shortcut for "run all"? Any way (or shortcut) to auto import the classes in IntelliJ IDEA like in Eclipse? How do I duplicate a line or selection within Visual Studio Code? How do I search for files in Visual Studio Code? OS X Terminal shortcut: Jump to beginning/end of line window.close() doesn't work - Scripts may close only the windows that were opened by it Comment shortcut Android Studio Column/Vertical selection with Keyboard in SublimeText 3

Examples related to paste

Combine several images horizontally with Python VBA paste range Paste multiple columns together jQuery bind to Paste Event, how to get the content of the paste How do I paste multi-line bash codes into terminal and run it all at once? Get current clipboard content? Eclipse copy/paste entire line keyboard shortcut Catch paste input