Reputation: 6732
Is there any possibility to create own teamplates which will be used with "Surround with" (ctrl+alt+T) or "Surround with live template" (ctrl+alt+J)?
For example, I would like to create template for HTML which will be surrounding selected text with PHP comments:
<?php /* SELECTED TEXT */ ?>
Upvotes: 1
Views: 46
Reputation: 165168
Easy -- it's ordinary Live Template -- just with special $SELECTION$
variable used.
For example:
try {
$SELECTION$
} catch ($TYPE$ $$$VARIABLENAME$) {
Logger::log($$$VARIABLENAME$);
$END$
}
P.S. I suggest to create and use own groups for your own templates and not create them in existing/bundled groups: easier management (backup/sharing/etc); no possible screw ups when bundled ones will be updated in next major version etc.
Upvotes: 3