mirror of
https://github.com/neovim/neovim.git
synced 2026-05-24 05:40:08 +00:00
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.
This commit is contained in:
committed by
GitHub
parent
846b8b2420
commit
db0682fe50
@@ -281,7 +281,7 @@ function M.get(lang)
|
||||
info.lang,
|
||||
info.encoding
|
||||
)
|
||||
vim.ui.input({ prompt = prompt }, function(input)
|
||||
vim.ui.input({ prompt = prompt, scope = 'editor' }, function(input)
|
||||
-- properly clear the message window
|
||||
vim.api.nvim_echo({ { ' ' } }, false, { kind = 'empty' })
|
||||
if not input or input:lower() ~= 'y' then
|
||||
|
||||
Reference in New Issue
Block a user