Eclipse copy/paste entire line keyboard shortcut

后端 未结 25 3000
感动是毒
感动是毒 2020-12-07 07:05

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

相关标签:
25条回答
  • 2020-12-07 07:48

    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

    0 讨论(0)
  • 2020-12-07 07:49
    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.

    0 讨论(0)
  • 2020-12-07 07:49

    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

    0 讨论(0)
  • 2020-12-07 07:49

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

    Try it with,

    ALT + COMMAND + DOWN

    It works.

    0 讨论(0)
  • 2020-12-07 07:49

    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

    0 讨论(0)
  • 2020-12-07 07:49

    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.

    0 讨论(0)
提交回复
热议问题