eclipse 多个文本选择,如 sublime text 2
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12583201/
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
eclipse multiple text selection like sublime text 2
提问by user744959
is there an option or plugin for eclipse which would enable multiple simultaneous selections in the same editor.
是否有 Eclipse 的选项或插件可以在同一编辑器中启用多个同时选择。
In sublime text, selecting some text and then pressing Ctrl+d will add next instance of the same text to the selection if possible. After selecting the instances needed the editor has multiple carrets (not necessarily on the same or adjacent columns and rows). In this mode it is possible to move all cursors forward or back simultaneously and to edit all instances of text simuntaneously.
在 sublime text 中,如果可能,选择一些文本然后按 Ctrl+d 会将相同文本的下一个实例添加到选择中。选择所需的实例后,编辑器有多个插入符号(不一定在相同或相邻的列和行上)。在此模式下,可以同时向前或向后移动所有光标并同时编辑所有文本实例。
I find this feature very usefull and miss it sorely in eclipse..
我发现这个功能非常有用,并且在 eclipse 中非常想念它。
采纳答案by Trevor Dixon
This Eclipse plugin attempts to provide this feature: https://github.com/caspark/eclipse-multicursor. From the README:
这个 Eclipse 插件试图提供这个功能:https: //github.com/caspark/eclipse-multicursor。从自述文件:
What is this?
A work-in-progress attempt to provide Sublime-Text-like multi cursor support for text editors in the Eclipse IDE.
What works?
- Multiple identical lines can be edited simultaneously using Eclipse linked mode editing (similar to existing "rename in file" functionality)
Next steps
"select next" functionality + associated editing using Eclipse linked mode
"find next" + associated editing
editing of non-identical text / editing without using linked mode
split selection to lines
regexp support for find next
这是什么?
正在尝试为 Eclipse IDE 中的文本编辑器提供类似 Sublime-Text 的多光标支持。
什么工作?
- 可以使用 Eclipse 链接模式编辑同时编辑多个相同的行(类似于现有的“重命名文件”功能)
下一步
“选择下一个”功能 + 使用 Eclipse 链接模式进行关联编辑
“查找下一个”+ 相关编辑
编辑不相同的文本/不使用链接模式进行编辑
将选择拆分为行
正则表达式支持查找下一个
回答by Fabio Zadrozny
This feature is available in LiClipse.
此功能在LiClipse 中可用。
See it in action(more towards the end of the video).
看看它的实际效果(更多在视频末尾)。
It supports linking with Ctrl+K, unlink with Shift+Alt+K, Ctrl+Alt+mouse double click to select words or Ctrl+Alt+Mouse to make a selection of a region (or just end lines).
它支持与链接Ctrl+ K,取消链接与Shift+ Alt+ K,Ctrl+ Alt+鼠标双击选择的词或Ctrl+ Alt+鼠标进行选择的区域的(或刚刚结束线)。
回答by andy9775
Preferences>General>keys>Rename - refactoring I changed the binding to command + shift + R when > Editing Text. Sorry for bringing up an old question, stumbled upon it after searching google for the problem
Preferences>General>keys>Rename - refactoring 我将绑定更改为 command + shift + R when > Editing Text。很抱歉提出一个老问题,在谷歌搜索问题后偶然发现
回答by Hyman
Like Ctrl+DI could not find, but like Alt+F3in sublime (multiselects all matches), you can do by pressing Alt+Shift+R, or select text > right click > refactor > rename
.
像Ctrl+D我找不到,但像sublime 中的Alt+ F3(多选所有匹配项),您可以按Alt+ Shift+R或select text > right click > refactor > rename
.
Must say that this does not work with any kind of text. It works with names of variables, functions, classes etc.
必须说这不适用于任何类型的文本。它适用于变量、函数、类等的名称。
Tested on Eclipse 3.8.1
在 Eclipse 3.8.1 上测试
回答by FabianoLothor
Alt+ Shift+ A, then you can hold shift and use the cursor in multiple lines.
Alt+ Shift+ A,然后您可以按住 shift 并在多行中使用光标。
回答by Huynh Van Thuy
ALT+ SHIFT+ Fworked for me.
ALT+ SHIFT+F对我来说有效。
回答by Blasanka
You can see shortcuts for all here:
您可以在此处查看所有快捷方式:
Goto -> Window -> Preferences -> General -> Keysand search for replacethen you will see binding for Find and replace. In the bottom of that window, you can add your key to Bindingtext box. There you can add or edit any keys as shortcut.
转到 -> Window -> Preferences -> General -> Keys并搜索replace然后您将看到Find and replace 的绑定。在该窗口的底部,您可以将密钥添加到绑定文本框。在那里您可以添加或编辑任何键作为快捷方式。
If you want to replace selected word's matching words or find selected words, use below keys because you do not need to select all words in eclipse:
如果要替换所选单词的匹配单词或查找所选单词,请使用以下键,因为您不需要在 eclipse 中选择所有单词:
Ctrl+Fgives me Find/Replace dialog box.
Ctrl+F给了我查找/替换对话框。
Or you can,
或者你可以,
First Alt+A
第一Alt+A
Next Alt+F
下一个Alt+F
Then press on Replaceor Searchbutton occurding to your need.
然后按您需要的替换或搜索按钮。