Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customizing Cut line in eclipse with Ctrl-X

Is it possible to configure Eclipse to cut lines with Ctrl+X? Is it more intuitive and leave Ctrl+D to duplicate lines? I am trying IntelliJ now and keep typing Ctrl+D to delete lines which duplicates.

EDIT : Wow, already five responses. I want Ctrl+X to cut the whole line if nothing is selected, otherwise do a regular cut. Same thing with Ctrl+C. It is a nice feature in IntelliJ.

like image 779
fastcodejava Avatar asked Jan 01 '11 18:01

fastcodejava


People also ask

How do I select a single line in Eclipse?

Solution for Eclipse:Hold Alt and press ↑ and ↓ .

How do I duplicate a line in Eclipse?

In Eclipse you can duplicate a codeline via the shortcut CTRL+ALT+Up/Down.


2 Answers

Every time I istall Eclipse I forget it doesn't have this functionality by default and have to search to fix it.

This plugin works for me and does exactly (and only) what the original poster asks for

http://code.google.com/p/copycutcurrentline/

like image 75
Wilson Waters Avatar answered Oct 05 '22 12:10

Wilson Waters


  1. Click Window -> Preferences
  2. Expand General -> Keys
  3. Set filter text to: cut
  4. Select Cut Line
  5. Set Binding to: Ctrl+x
  6. Select Cut
  7. Set Binding to empty (by pressing Backspapce).

You can also swap the Binding for Delete Line and Duplicate Line commands within the Preferences dialog.

Cut line

like image 29
João Silva Avatar answered Oct 05 '22 13:10

João Silva