Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible in Eclipse to highlight a statement, and then press quotes/etc.. to "wrap" the highlighted text in the character (like in SublimeText)?

Tags:

java

eclipse

I'm coming from Sublime Text to Eclipse. One of my favorite feature of ST is highlighting a piece of text, and then being able to wrap it in quotations or parenthesis by pressing the appropriate key.

That probably poorly explains the functionality, so here's a gif example:

enter image description here

So, as you can see, if you highlight a piece of text, and then, in this example, press ( it will wrap the highlighted text in parenthesis.

When I try this in Eclipse, highlighting the text, and then pressing ( simply replaces what I highlighted rather than wrapping it up.

Is there a way to get this functionality inside of Eclipse?

like image 949
Zack Avatar asked Oct 19 '12 17:10

Zack


2 Answers

Highlight the text, cut it (ctrl x), type quotes, paste text (ctrl v).

It's kind of a lame solution but it's faster since eclipse creates both quotes and puts cursor in the middle.

like image 179
Jake Zeitz Avatar answered Nov 07 '22 06:11

Jake Zeitz


I don't think this functionality is in Eclipse by default, but you could try to add it yourself.

Select the block that you want to surround and press Alt+Shift+Z. This will open the "Surround with..." menu. It suggests some predefined templates, but also allows to add new ones. This is the closest of what Eclipse offers for that.

like image 34
antiguru Avatar answered Nov 07 '22 07:11

antiguru