Birgersen
Birgersen

Reputation: 23

How to insert lambda (λ) symbol with IntelliJ?

I want to use a keyboard shortcut to insert the λ sign in IntelliJ. Jetbrains employee Hadi Hariri explains in this video at 12:48 that you can insert the lambda symbol by pressing Alt + F.

Hadi has the following code:

fun higherOrderFunction(f: (Int, Int) -> Int) {}

Then he marks the f character and I believe he type Alt + F.

For Hadi, that results in:

fun higherOrderFunction(λ: (Int, Int) -> Int) {}

For me, it results in selecting the File menu.

How can I make IntelliJ replace the f with λ?

Update: Some people believe this is a duplicate, but I'm aware of that other question and that doesn't answer my question. The other question ask how to use Greek letters, I ask how IntelliJ can convert the character f into λ.

Upvotes: 2

Views: 2108

Answers (1)

Saxintosh
Saxintosh

Reputation: 332

He uses a simple "Live Templates" (Preferences... -> Live Templates), triggered by the ƒ symbol (alt-F on a Mac) as you can see in the "Abbreviation" text-field.

Live template in IntelliJ

Upvotes: 3

Related Questions