Skip to main content
Module

x/ddc_vim/deps.ts>fn.input

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.input
import { fn } from "https://deno.land/x/ddc_vim@v2.3.0/deps.ts";
const { input } = fn;

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: :if input("Coffee or beer? ") == "beer" : echo "Cheers!" :endif If the optional {text} argument is present and not empty, this is used for the default reply, as if the user typed this. Example: :let color = input("Color? ", "white") The optional {completion} argument specifies the type of completion supported for the input. Without it completion is not performed. The supported completion types are the same as that can be supplied to a user-defined command using the "-complete=" argument. Refer to |:command-completion| for more information. Example: let fname = input("File: ", "", "file") NOTE: This function must not be used in a startup file, for the versions that only run in GUI mode (e.g., the Win32 GUI). Note: When input() is called from within a mapping it will consume remaining characters from that mapping, because a mapping is handled like the characters were typed. Use |inputsave()| before input() and |inputrestore()| after input() to avoid that. Another solution is to avoid that further characters follow in the mapping, e.g., by using |:execute| or |:normal|. Example with a mapping: :nmap \x :call GetFoo():exe "/" . Foo<CR :function GetFoo() : call inputsave() : let g:Foo = input("enter search pattern: ") : call inputrestore() :endfunction Can also be used as a |method|: GetPrompt()->input()

Parameters

denops: Denops
prompt: string
optional
text = [UNSUPPORTED]
optional
completion: BuiltinCompletion | (string & { _?: never; })

Returns

Promise<string>