mirror of
https://github.com/neovim/neovim.git
synced 2026-06-16 16:51:19 +00:00
backport: opts.scope in vim.ui.input (#39906)
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
b0bfce290f
commit
b05675bccc
@@ -815,6 +815,7 @@ function M.rename(new_name, opts)
|
||||
|
||||
local prompt_opts = {
|
||||
prompt = 'New Name: ',
|
||||
scope = 'cursor',
|
||||
}
|
||||
if result.placeholder then
|
||||
prompt_opts.default = result.placeholder
|
||||
@@ -845,6 +846,7 @@ function M.rename(new_name, opts)
|
||||
local prompt_opts = {
|
||||
prompt = 'New Name: ',
|
||||
default = cword,
|
||||
scope = 'cursor',
|
||||
}
|
||||
vim.ui.input(prompt_opts, function(input)
|
||||
if not input or #input == 0 then
|
||||
|
||||
Reference in New Issue
Block a user