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

Prompts

There are two primary ways to prompt the user for input. You can either use confirm to display a multiple choice dialog (such as yes/no/cancel), or input to process a more complex input.

The confirm function prompts the user with a dialog and a multiple answers a user can select from. Let's try a simple example:

let answer = confirm('Is cat your favorite animal?', "&yes\n&no")echo answer

If you execute the script, you'll get the following prompt:

Hitting y or n will select an option. Let's hit y:

The result of this is 1. Now, what ...

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