简体   繁体   中英

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 .

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/

  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.

切割线

Yes, use the Preferences dialog to configure the keyboard shortcuts. But I find the defaults to be more useful:

  • Alt + Down duplicates line below current line ( Up duplicates above)
  • Ctrl + Alt + Down swaps the current line with the line below it ( Up swaps with line above), essentially moving the current line up or down

I've searched for the same functionality - moving the line ( Alt - arrow ) or duplicating ( Ctrl - Alt - arrow ) is not the same - not when you want to get the line into completely different file, for instance.

There is an issue on Eclipse's bugzilla for this - since 2002.

IntelliJ IDEA has Ctrl + X / C when nothing is selected (and hardly was first editor to do it that way) and it just works really nicely. You can somehow imitate this behavior for copy - duplicate the line and cut it ( Ctrl - Alt - arrow down , then Ctrl + x ).

You can already delete lines with CTRL + X ! (In fact you cut them, but however they are not there anymore)

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.

I created an Eclipse Plugin for this.

Eclipse Marketplace: https://marketplace.eclipse.org/content/lineshortcuts

GitHub: https://github.com/achimmihca/EclipseLineShortcuts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM