Parentheses over selected words in Eclipse
Asked Answered
O

1

5

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.

Oriental answered 3/1, 2012 at 6:31 Comment(0)
B
7

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}
Bastardize answered 3/1, 2012 at 14:9 Comment(1)
For Eclipse Indigo: Window -> Preferences -> Java -> Editor -> TemplatesVacuum

© 2022 - 2024 — McMap. All rights reserved.