eclipse 如何进行多行编辑?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9460945/
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
How to do multiple line editing?
提问by yuda
I want to edit multiple lines in eclipse, but I can't find any short cut or Plugin. In Geany I just press ctrl+alt+up/downI can add / edit multiple lines.
我想在eclipse中编辑多行,但找不到任何快捷方式或插件。在 Geany 中,我只需按ctrl+ alt+ up/down我就可以添加/编辑多行。
Maybe this example can explain what I mean:
也许这个例子可以解释我的意思:
var text = "myname";
var addr = "myaddr";
var age = "myage";
I want to edit text above into:
我想将上面的文本编辑为:
var my_text = "myname";
var my_addr = "myaddr";
var my_age = "myage";
The text above is just a simple example, but sometimes I have many lines of words that I have to edit its prefix.
上面的文字只是一个简单的例子,但有时我有很多行必须编辑其前缀的单词。
回答by Harry Joy
Press alt+ shift+ Ato Toggle block selection(Toggle block / column selection in the current text editor), this will let you write vertically in eclipse, then you can easily do this.
按alt+ shift+A以切换块选择(在当前的文本编辑器切换块/列选择),这会让你在eclipse垂直写,那么你可以很容易地做到这一点。
Go to Window->Preferences.
转到窗口-> 首选项。
Find for binding in text box surrounded by red box.
在红色框包围的文本框中查找绑定。
回答by Erich
On OS X, the key combination for multi-line edits in Eclipse (or STS) is option/alt+command+A
在 OS X 上,Eclipse(或 STS)中多行编辑的组合键是option/alt+ command+A
回答by Karthik P
You can try the following plugin,
您可以尝试以下插件,
https://github.com/caspark/eclipse-multicursor/releases
https://github.com/caspark/eclipse-multicursor/releases
With this multiple occurrence of same text can be selected and edited. This is similar to multi select functionality available in editors like Sublime and Visual studio code.
可以选择和编辑多次出现的相同文本。这类似于 Sublime 和 Visual Studio 代码等编辑器中可用的多选功能。