Reputation: 4385
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:
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?
Upvotes: 11
Views: 2183
Reputation: 2574
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.
Upvotes: 3
Reputation: 3278
I haven't found a way to to obtain exactly this, but if you want to surround the text with quotes, here's how to. Go to:
Source -> Surround With... -> Configure Templates
Create a new template, use brackets
as name, and this as pattern:
(${word_selection})${cursor}
You can then obtain the functionality you wanted by pressing CTRL + SPACE and then chose your template.
Upvotes: 0
Reputation: 1131
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.
Upvotes: 1