Parentheses over selected words in Eclipse

两盒软妹~` 提交于 2019-12-10 16:36:38

问题


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.


回答1:


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}


来源:https://stackoverflow.com/questions/8708723/parentheses-over-selected-words-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!