# Key Bindings This file lists all of the key bindings currently registered by prompts. ## All prompts These key bindings may be used with all prompts. | **command** | **description** | | -------------------------------- | ----------------------- | | enter | Submit answer. | | esc | Cancel the prompt\*. | | ctrl + c | Interrupt the prompt\*. | \* Canceling and interrupting a prompt have two different meanings. Canceling is defined specially for when the end user is allowed to skip a prompt, the library user can then use `prompt_skippable` which wraps the return type into an `Option` and catches the `CanceledOperation` error transforming it into a `Ok(None)` result. Interrupted operations are closer to "stop-the-world" operations, where the library user should treat them as termination commands. ## Text Input These key bindings may be used with all prompts that ask the user for text input: [`Text`], [`Select`], [`MultiSelect`], [`Confirm`], [`CustomType`] and [`Password`]. The [`Editor`] prompt is not included because it opens a separate text editor for text input. | **command** | **description** | | ----------------------------------- | ----------------------------------------------- | | character | Insert the character into the input. | | left | Move the cursor back one character. | | right | Move the cursor forward one character. | | ctrl + left | Move one word to the left of the cursor. | | ctrl + right | Move one word to the right of the cursor. | | home | Move cursor to the start of the line*. | | end | Move cursor to the end of the line*. | | backspace | Delete one character to the left of the cursor. | | delete | Delete the character at the cursor. | | ctrl + delete | Delete one word to the right of the cursor. | \* Key bindings not supported on [`Select`] and [`MultiSelect`] prompts. ## Text Prompts These key bindings may be used in [`Text`] prompts. | **command** | **description** | | -------------------- | ------------------------------------------------------------- | | enter | Submit the current current text input. | | up | When suggestions are displayed, move cursor one row up. | | down | When suggestions are displayed, move cursor one row down. | | page up | When suggestions are displayed, move cursor one page up. | | page down | When suggestions are displayed, move cursor one page down. | | tab | Replace current input with the resulting suggestion if any. | | others | See [Text Input](#text-input) and [All Prompts](#all-prompts) | ## Select Prompts These key bindings may be used in [`Select`] prompts. | **command** | **description** | | -------------------- | ------------------------------------------------------------- | | enter | Submit the current highlighted option. | | up | Move cursor one row up. | | down | Move cursor one row down. | | k | Move cursor one row up when vim mode is enabled. | | j | Move cursor one row down when vim mode is enabled. | | page up | Move cursor one page up. | | page down | Move cursor one page down. | | home | Move cursor to the first option. | | end | Move cursor to the last option. | | others | See [Text Input](#text-input) and [All Prompts](#all-prompts) | ## MultiSelect Prompts These key bindings may be used in [`MultiSelect`] prompts. | **command** | **description** | | -------------------- | ------------------------------------------------------------- | | enter | Submit the options currently selected. | | space | Toggle the selection of the current highlighted option. | | up | Move cursor one row up. | | down | Move cursor one row down. | | k | Move cursor one row up when vim mode is enabled. | | j | Move cursor one row down when vim mode is enabled. | | page up | Move cursor one page up. | | page down | Move cursor one page down. | | home | Move cursor to the first option. | | end | Move cursor to the last option. | | left | Unselect all options. | | right | Select all options. | | others | See [Text Input](#text-input) and [All Prompts](#all-prompts) | ## DateSelect Prompts These key bindings may be used in the interactive calendar of the [`DateSelect`] prompt. | **command** | **description** | | ---------------------------------------- | ------------------------------------------------------------- | | space bar or enter | Submit the current highlighted date. | | up | Move cursor one row up. | | down | Move cursor one row down. | | left | Move cursor one column to the left. | | right | Move cursor one column to the right. | | k | Move cursor one row up when vim mode is enabled. | | j | Move cursor one row down when vim mode is enabled. | | h | Move cursor one column to the left when vim mode is enabled. | | l | Move cursor one column to the right when vim mode is enabled. | | ctrl + up | Move calendar back by one year. | | ctrl + down | Move calendar forward by one year. | | ctrl + left | Move calendar back by one month. | | ctrl + right | Move calendar forward by one month. | ## Editor Prompts These key bindings may be used in [`Editor`] prompts. | **command** | **description** | | ---------------- | -------------------------------------------------------------- | | e | Open the editor. | | enter | Submit the current content of the temporary file being edited. | [`Text`]: https://docs.rs/inquire/*/inquire/prompts/text/struct.Text.html [`DateSelect`]: https://docs.rs/inquire/*/inquire/prompts/dateselect/struct.DateSelect.html [`Select`]: https://docs.rs/inquire/*/inquire/prompts/select/struct.Select.html [`MultiSelect`]: https://docs.rs/inquire/*/inquire/prompts/multiselect/struct.MultiSelect.html [`Confirm`]: https://docs.rs/inquire/*/inquire/prompts/confirm/struct.Confirm.html [`Editor`]: https://docs.rs/inquire/*/inquire/prompts/editor/struct.Editor.html [`customtype`]: https://docs.rs/inquire/*/inquire/struct.CustomType.html [`Password`]: https://docs.rs/inquire/*/inquire/prompts/password/struct.Password.html