Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/function/input.ts

๐Ÿ“š Standard module for denops.vim
Go to Latest
import * as denopsStd from "https://deno.land/x/denops_std@v6.3.0/function/input.ts";

Functions

The result is a String, which is whatever the user typed on the command-line. The {prompt} argument is either a prompt string, or a blank string (for no prompt). A '\n' can be used in the prompt to start a new line. The highlighting set with :echohl is used for the prompt. The input is entered just like a command-line, with the same editing commands and mappings. There is a separate history for lines typed for input(). Example:

{textlist} must be a List of strings. This List is displayed, one string per line. The user will be prompted to enter a number, which is returned. The user can also select an item by clicking on it with the mouse, if the mouse is enabled in the command line ('mouse' is "a" or includes "c"). For the first string 0 is returned. When clicking above the first item a negative number is returned. When clicking on the prompt one more than the length of {textlist} is returned. Make sure {textlist} has less than 'lines' entries, otherwise it won't work. It's a good idea to put the entry number at the start of the string. And put a prompt in the first item. Example:

Restore typeahead that was saved with a previous inputsave(). Should be called the same number of times inputsave() is called. Calling it more often is harmless though. Returns TRUE when there is nothing to restore, FALSE otherwise.

Preserve typeahead (also from mappings) and clear it, so that a following prompt gets input from the user. Should be followed by a matching inputrestore() after the prompt. Can be used several times, in which case there must be just as many inputrestore() calls. Returns TRUE when out of memory, FALSE otherwise.

This function acts much like the input() function with but two exceptions: a) the user's response will be displayed as a sequence of asterisks ("*") thereby keeping the entry secret, and b) the user's response will not be recorded on the input history stack. The result is a String, which is whatever the user actually typed on the command-line in response to the issued prompt. NOTE: Command-line completion is not supported.