Search code examples
phpstorm

phpStorm - create a template format


Suppose I have a constant template which is highly frequency typed ,

how could I generate a Shortcut Key which would type this template each time I hit that Shortcut Key ?

For eample -

I have the template -

<?php echo $myObj->getValue('arg1'); ?>

and I want each press on Shortcut Key Ctrl+c+f would paste the above template .


Solution

  • I do not know if this can have a direct shortcut, but you can insert such code with ctrl+j cursor and enter

    For that you need to go to

    File -> Settings -> Live Templates

    Add another one for your needs. Bonus this way is, you can make a tab stop at the position of arg1 and quickly change that on every insert.