mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
feat(prompt): prompt_getinput() gets current input #34491
Problem: Not easy to get user-input in prompt-buffer before the user submits the input. Under the current system user/plugin needs to read the buffer contents, figure out where the prompt is, then extract the text. Solution: - Add prompt_getinput(). - Extract prompt text extraction logic to a separate function
This commit is contained in:
@@ -8332,6 +8332,21 @@ M.funcs = {
|
||||
signature = 'printf({fmt}, {expr1} ...)',
|
||||
returns = 'string',
|
||||
},
|
||||
prompt_getinput = {
|
||||
args = 1,
|
||||
base = 1,
|
||||
desc = [=[
|
||||
Gets the current user-input in |prompt-buffer| {buf} without invoking
|
||||
prompt_callback. {buf} can be a buffer name or number.
|
||||
|
||||
If the buffer doesn't exist or isn't a prompt buffer, an empty
|
||||
string is returned.
|
||||
|
||||
]=],
|
||||
name = 'prompt_getinput',
|
||||
params = { { 'buf', 'integer|string' } },
|
||||
signature = 'prompt_getinput({buf})',
|
||||
},
|
||||
prompt_getprompt = {
|
||||
args = 1,
|
||||
base = 1,
|
||||
|
Reference in New Issue
Block a user