I know this is a little late answer, but I hope anyone who looks this question get helped.
In PhpStorm, almost everything can be configured but a little tricky and takes some learning curve.
It's very common behaviour that select a word and type single quote (or double quote) to surround it.
Hello World
'Hello World'
"Hello World"
To enable this, tick on checkbox of Preferences -> IDE -> Editor -> Smart Keys -> Surround Selection on typing quote or brace
.
Another way, you select something (word, condition) and press Cmd + Alt + T (on Mac) , Ctrl + Alt + T (on Windows). Available Surround With
options dialog box will be displayed.
For PhpStorm Version 8, tick on checkbox of Preferences -> Editor -> General -> Smart Keys -> Surround selection on typing quote or brace
.
For PhpStorm Version 2016, use Cmd + Alt + S (on Mac) or Ctrl + Alt + S (on Win) to go to Settings. Tick on checkbox of Settings -> Editor -> General -> Smart Keys -> Surround selection on typing quote or brace`.
As of 2015-02-26 (PhpStorm 8) go to:
File > Settings... > Editor > General > Smart Keys > Surround selection on typing quote or brace
How to create a live template to easily change Hello World
into {{ trans 'Hello World' }}
:
{{ trans '$SELECTION$' }}
After that select Hello World
and use step 1 from above, select a rule with your "Abbreviation"
This is just a more detailed answer than @Steve.NayLinAung . Credit goes to @LazyOne
On a Mac, it's
PhpStorm > Preferences > Editor > General > Smart Keys > Surround selection on typing quote or brace
.
You can also press command+,
to open the Preferences menu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With