Java Eclipse 复制/粘贴整行键盘快捷键

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2321938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 06:07:18  来源:igfitidea点击:

Eclipse copy/paste entire line keyboard shortcut

javaeclipsecopykeyboard-shortcutspaste

提问by Prabhu

Anyone know the keyboard shortcut to copy/paste a line into a new line in Eclipse, without having to highlight the entire line?

任何人都知道将一行复制/粘贴到 中的新行的键盘快捷键Eclipse,而不必突出显示整行?

ctrl-alt-downturns my whole screen upside down (I'm on windows). Interestingly, that's what's specified in the windows->preferences.

ctrl- alt-down把我的整个屏幕倒过来(我在窗户上)。有趣的是,这就是 windows->preferences 中指定的内容。

采纳答案by Pierre-Antoine LaFayette

Ctrl-Alt-Down: copies current line or selected lines to below

Ctrl- Alt- Down: 将当前行或选定行复制到下方

Ctrl-Alt-Up:: copies current line or selected lines to above

Ctrl- Alt- Up:: 将当前行或选定行复制到上面

Ctrl-Shift-L: brings up a List of shortcut keys

Ctrl- Shift- L: 调出快捷键列表

See Windows/Preference->General->Keys.

请参阅 Windows/首选项-> 常规-> 键。

回答by larsch

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

我已经为 Eclipse编写了linecopypaste插件,它模仿了 Visual Studio 的复制/剪切/粘贴行为。我还发现copycutcurrentline似乎也做同样的事情。

回答by Renso Lohuis

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

如果要将一行复制到剪贴板,也可以使用以下技巧:

Ctrl-Alt-Downfollowed by Ctrl-X

Ctrl- Alt-Down紧随其后 Ctrl-X

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

缺点是您从中复制该行的文件变脏了。

回答by clav

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).

您必须关闭翻转屏幕的图形热键。如果您使用的是 Windows,则需要右键单击 Windows 桌面并选择“图形属性...”(或类似的选项,具体取决于您的 Windows 版本)。这将打开一个屏幕,您可以在其中管理图形和显示选项,寻找可以禁用热键的地方,有时它会隐藏在“选项和支持”之类的东西下。关闭CTRL+ ALT+CTRL+ ALT+热键(或者,如果您不使用它们,则可以禁用所有图形热键)。

回答by beam022

  1. Ctrl-Dwould delete a line
  2. Ctrl-Zwould undo deletion, with highlithing entire line
  3. Ctrl-X/Ccut or copy entire line
  1. Ctrl-D会删除一行
  2. Ctrl-Z将撤消删除,高亮​​整行
  3. Ctrl- X/C剪切或复制整行

The advantage over Ctrl-Alt-Downfollowed by Ctrl-Xsuggested 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/Upkeyboard shorcut. So there's no need to remap shorcuts for this.

其他用户建议的Ctrl- Alt-Down其次Ctrl-的优点X是它不会让 eclipse 认为文件以任何方式被更改。即使用户使用Ctrl- Alt- Down/Up键盘快捷键出现旋转屏幕问题,它也更快并且不会引起任何问题。所以没有必要为此重新映射快捷方式。

Another way to go would be hitting Alt-Shift-Upuntil the entire line gets selected. If you've gone too far, of course you can select less with Alt-Shift-Down.

另一种方法是点击Alt- Shift-Up直到整行都被选中。如果你走得太远,当然你可以用Alt- Shift-选择更少Down

回答by KrishPrabakar

(Tested in Windows)

(在 Windows 中测试)

  1. In Eclipse, press Ctrl+Shift+Ltwo timesin succession.
  2. In 'type filter text' 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
  1. 在Eclipse中,按Ctrl+ Shift+L两次连续。
  2. 在“类型过滤器文本”文本框中,输入 Copy Lines
  3. 选择过滤后的行,右键单击“绑定”字段,然后执行 Select All
  4. Ctrl+ Shift+V
  5. OK

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

从现在开始,对于要复制的任何行,只需按Ctrl+ Shift+ V

回答by Amit S

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

我必须更改分配的键,例如

Windows/Preference --> General --> Keys

Windows/首选项 --> 常规 --> 键

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

在命令下选择“Duplicate Lines” 点击“Binding” Ctrl+ Shift+D

回答by nanosoft

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 :)

我使用的是 Windows 7。要禁用它,我所做的就是右键单击 Windows 桌面并选择“图形属性”->“选项”。然后在结果屏幕的左侧选择“关闭”。这禁用了所有热键组合。我认为没有办法只禁用一些,要么全部禁用,要么不禁用。反正我不需要它们。所以现在 crtl+Alt+Up 和 Crtl+Alt+down 在 Eclipse 中对我有用,我的屏幕保持不变:) 我认为类似的选项也存在于其他版本的 Windows 中。玩得开心 :)

回答by user1369641

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-Downkeystoke. 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-Downand copies the line.

禁用为我工作为Windows 7不过英特尔驱动程序的热键,为Windows 8,当我试过了,它获得防止日食Ctrl- Alt- Downkeystoke。我不得不将 Intel 驱动程序密钥绑定更改为Ctrl- Alt- F10(或它会接受的其他内容)。Eclipse 然后获取Ctrl- Alt-Down并复制该行。

回答by Chris

On my Mac the default setting is is ALT+CMD+Down

在我的 Mac 上,默认设置是ALT+ CMD+Down

You can change/view all key bindings by going Eclipse -> Preferences (shortcut CMD+,) and then General -> Keys

您可以通过转到 Eclipse -> Preferences(快捷键CMD+ ,)然后 General -> Keys来更改/查看所有键绑定