在Eclipse中选定单词的括号 [英] Parentheses over selected words in Eclipse

查看:117
本文介绍了在Eclipse中选定单词的括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,我觉得这个问题很愚蠢,但是经过大量搜索后,我还是找到了合适的解决方案.

对于使用 TextEdit (在Mac上)的用户,他们将完全了解我在说什么.

在编码时,我只想在单词或行上加上引号或括号.为此,我必须回到单词的开头,打开引号,然后转到单词的末尾,然后关闭它.

eclipse中是否有一个插件或类似的插件,我可以用引号或括号括住当前选择?我不是在谈论快速修复(Ctrl + 1).它可以用于复杂得多的模板.

解决方案

您可以使用自定义模板来完成此操作,例如,如果要为Java创建此模板,则可以执行以下操作:

Preferences ---> Java  ---> Templates

创建一个新模板并将其命名为quote,然后将其键入为pattern:

"${word_selection}"${cursor}

保存并应用.

之后,您可以使用该模板选择要引用的文本,然后按 CTRL + SPACE ,然后选择引号.

括号中的内容也相同:

(${word_selection})${cursor}

A few days back I felt this question to be dumb and dint post it here, but after even after searching a lot I dint find a proper solution.

For those of you who used TextEdit (on Mac), they will perfectly know what I am talking about.

While coding I just want to put quotes or parentheses over a word or a line.To do this I'll have to move back to the starting of the word, open the quote and then go to the ending of the word and close it.

Is there a plugin or so in eclipse where I can just surround the current selection with quotes or parenthesis ?? I am not talking about quick fix (Ctrl + 1). It can be used for much complex templates.

解决方案

You can do that with a custom template, so for example if you want to create this template for java, you can do :

Preferences ---> Java  ---> Templates

Create a new template and call it quote, then type this as pattern :

"${word_selection}"${cursor}

Save it and Apply.

After that you can use that template selecting the text you want to quote then press CTRL + SPACE and then chose quote.

Same thing for parenthesis :

(${word_selection})${cursor}

这篇关于在Eclipse中选定单词的括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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