Eclipse环绕着引号和其他块 [英] Eclipse surround with quotes and other blocks

查看:149
本文介绍了Eclipse环绕着引号和其他块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现自己想在eclipse中突出显示一个字符串,然后双引号或单引号。我似乎找不到它的捷径。例如,如果我突出显示一个字符串并键入一个'或',那么字符串将被它们包围。同样应该使用)和}}我想也是如此。

I find myself wanting to highlight a string in eclipse and double or single quoting it. I can't seem to find a shortcut for it. In textmate for example if i highlight a string and type either a ' or a " the string will be surrounded with them. The same should work with ) and } i think as well.

我已经添加了一个代码模板来执行此操作,但它并没有出现在菜单中,似乎也没有办法为它创建快捷方式。请注意,这应该完全由键盘驱动,而不是涉及任何二级菜单,这无论如何都是我的目标。

I've added a code template for doing it but it doesn't ever appear in the menu and there doesn't seem to be a way to create shortcuts for it either. Note that this should be entirely keyboard driven and not involve any secondary menus, that's my goal anyway.

推荐答案

转到 Java>编辑器>模板 并添加新模板,例如名为 quote ,如下所示:

Go to Java > Editor > Templates and add a new template, e. g. called quote, as follows:

 "${word_selection}"${cursor}

然后,在编辑器中,写下您要引用的文字,选择,按 Ctrl + 空格 ,输入 报价 ,然后点击 返回 。突出显示现在应该引用分机。

Then, in the editor, write a text you want to quote, select it, press Ctrl+Space, type quote and hit Return. The highlighted text should be quoted now.

如果在按 Ctrl + Space 时没有获得模板提议,请make确保你已经在 Java>编辑器>内容辅助>高级中签入了它们。

If you don't get template proposals when pressing Ctrl+Space, make sure you have them checked in Java > Editor > Content Assist > Advanced.

试过它,它对我有用!

这篇关于Eclipse环绕着引号和其他块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆