Live Templates
Live templates help you to insert frequently-used constructions into your code. You insert them by typing the corresponding
abbreviation and pressing Tab
. For the full documentation, please refer to the
help page on jetbrains.com, because live templates work
similarly for the Wolfram Language Plugin.
To see which live templates are available or define additional shortcuts for the Wolfram Language, please navigate to
File | Settings | Editor | Live Templates and open the Wolfram Language section.
The naming convention for Wolfram Language live templates is often to shorten built-in functions by leaving out
vowels and only use lower-case letters.
This means, if you want to insert a With
block, you type wth
and press Tab
.
Currently, the Wolfram Language Plugin defines the following standard live templates:
blk
:Block[{vars}, body]
mdl
:Module[{vars}, body]
wth
:With[{vars}, body]
cmpl
:Compile[{vars}, body]
fnct
:Function[{vars}, body]
do
:Do[body, {iter}]
for
:For[start, test, inc, body]
tbl
:Table[body, {var, min, max}]
fld
:Fold[func, firstElement, list]
nst
:Nest[func, expr, n]
if
:If[cond, then]
ife
:If[cond, then, else]
swtch
:Switch[expr, form1, value1, form2, value2]
whch
:Which[test1, value1, test2, value2]
chck
:Check[expr, fail, msg]
pre
: Prefix selection withf@
pst
: Postfix selection with//f
ass
: Surround selection with<| |>
usg
: Create usage messageopt
: Create options for a symbolatt
: Create attributes for a symbolmsg
: Create usage message
Note that as explained on the Jetbrains help-page, live templates can also be used to surround a selected portion of code by pressing
Ctrl
+Alt
+J
.