O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lambda expressions

Lambdas are anonymous functions that can be really useful when working with somewhat straightforward logic.

Here's how we would define AnimalGreeting from the previous example using lambda expressions:

let AnimalGreeting = {animal -> animal . ' says hello'}

Let's test it:

:echo AnimalGreeting('cat')cat says hello

Lambdas provide short and sweet syntax for writing compact functions.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required