aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lua.txt
diff options
context:
space:
mode:
authorEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2026-05-17 18:34:06 +0300
committerGitHub <noreply@github.com>2026-05-17 11:34:06 -0400
commitdb0682fe50d863328c7ff335486545fd71df02ae (patch)
treeda1646a9301824e131bc4ccbbab9a3a3535d1c68 /runtime/doc/lua.txt
parent846b8b2420f074cc4c61ab57291b510b92ec0300 (diff)
downloadrneovim-db0682fe50d863328c7ff335486545fd71df02ae.tar.gz
rneovim-db0682fe50d863328c7ff335486545fd71df02ae.tar.bz2
rneovim-db0682fe50d863328c7ff335486545fd71df02ae.zip
feat(ui): vim.ui.input(opts.scope) #39570
Problem: There is no way for a `vim.ui.input` caller to indicate for which scope the input is. As in "This input is for something at cursor scope". This information can be useful for `vim.ui.input` implementation to tweak its behavior and presentation: - Show different floating window depending on the scope. For example: - Near cursor for "cursor" scope. - At line start for "line" scope. - In window corner for "buffer" and "window" scopes. - In whole editor corner for "tabpage", "editor", "project" scopes. - Navigate through history only for inputs with the same scope. Solution: Document new `opts.scope` for `vim.ui.input`. Use it in the codebase.
Diffstat (limited to 'runtime/doc/lua.txt')
-rw-r--r--runtime/doc/lua.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 8314f5a768..2f935f0882 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -5334,7 +5334,8 @@ vim.ui.input({opts}, {on_confirm}) *vim.ui.input()*
work until `on_confirm`.
Example: >lua
- vim.ui.input({ prompt = 'Enter value for shiftwidth: ' }, function(input)
+ local opts = { prompt = 'Enter value for shiftwidth: ', scope = 'buffer' }
+ vim.ui.input(opts, function(input)
vim.o.shiftwidth = tonumber(input)
end)
<
@@ -5349,6 +5350,14 @@ vim.ui.input({opts}, {on_confirm}) *vim.ui.input()*
• {highlight}? (`function`) Function that will be used
for highlighting user inputs.
• {prompt}? (`string`) Text of the prompt
+ • {scope}?
+ (`'cursor'|'line'|'buffer'|'window'|'tabpage'|'editor'|'project'`)
+ Input scope, as in "This input is for something at
+ cursor/line/etc scope". Can be used by `vim.ui.input`
+ implementations to tweak behavior and presentation.
+ For example, the input may adjust the floating window
+ position: near the cursor if `cursor`, in window
+ corner if `buffer` or `window`, etc.
• {on_confirm} (`fun(input?: string)`) Called once the user confirms or
abort the input. `input` is what the user typed (it
might be an empty string if nothing was entered), or