Brackets over selected words in Eclipse

A few days ago, I felt that this question was stupid and did not put it here, but after I searched many times many times, I found a suitable solution.

For those of you who have used TextEdit (on Mac), they are well aware of what I'm talking about.

During coding, I just want to put quotation marks or parentheses over a word or string. To do this, I have to go back to the beginning of the word, open the quote, and then go to the end 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 brackets? I'm not talking about a quick fix (Ctrl + 1). It can be used for complex patterns.

+4
source share
1 answer

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

Preferences ---> Java ---> Templates 

Create a new template and name it a quote, then enter it as a template:

 "${word_selection}"${cursor} 

Save and apply.

After that, you can use this template by selecting the text you want to quote, then press CTRL + SPACE , and then select a quote.

Same thing for parentheses:

 (${word_selection})${cursor} 
+5
source

Source: https://habr.com/ru/post/1389019/


All Articles