eclipseidetexteditinplace-editing

Parentheses over selected words in Eclipse


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.


Solution

  • 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}