stevearc / dressing.nvim Goto Github PK
View Code? Open in Web Editor NEWNeovim plugin to improve the default vim.ui interfaces
License: MIT License
Neovim plugin to improve the default vim.ui interfaces
License: MIT License
if i set telescope.theme = "cursor"
, it will still display with the default "dropdown"
I have a keymap set to <cmd>lua vim.lsp.buf.rename()<CR>
. When I invoke it dressing shows the float input as expected. When I hit enter to make the rename it changes only the position where I invoked instead of all occurrences.
When I removed dressing and it went back to the traditional input method it worked as expected.
I don't know if it happens with all LSP servers, but I tested with rust.
Describe the bug
The telescope front-end seems to omit one entry from the selection menu every time.
System information
vim.ui.select
require('dressing').setup {
input = {
winblend = 0,
},
}
Example
vim.ui.select({'Hello', 'World'}, {}, function () end)
Describe the bug
When using vim.ui.input
inside a command preview callback, the window title is not immediately positioned at the correct position.
System information
To Reproduce
Steps to reproduce the behavior:
vim.ui.input
inside the preview callback:vim.api.nvim_create_user_command("X", function() end, {
preview = function()
vim.ui.input({}, function() end)
end,
nargs = 1,
addr = "lines",
})
Type :X
. Notice how the title is positioned at the top left of the screen:
Type
(space). The title has now moved to the correct position:
Additional context
It seems like Nvim only executes one "step" of the window creation, while the last "step" of moving the title (which I believe is also a window) is scheduled to run later. Though I'm not exactly sure what causes this (probably somewhere in add_title_to_win).
Describe the bug
I just tried out dressing and I'm getting text artifacts in the rename window when the line above the to be renamed item has Rust attributes. See below for example code.
The green text below is the artifact, it should just say Webpage
.
The extra text is overwritten and disappears when typing over it.
System information
require('dressing').setup({})
To Reproduce
Steps to reproduce the behavior:
Webpage
below)#[derive(Serialize, Deserialize, Entity, Clone)]
#[factor(namespace = "semantic")]
pub struct Webpage {
}
Additional context
The relevant LSP is rust-analyzer, if that makes any difference.
As the title say, I wanna press q
to quit window like telescope
in the following configuration
local actions = require("telescope.actions")
local telescope = require("telescope")
telescope.setup({
defaults = {
mappings = {
n = {
["q"] = actions.close,
},
},
},
})
This plugin looks great! I have a hard time canceling a rename operation though, pressing Escape just changes to normal mode but doesn't close the rename input modal. Seems like I need to explicitly close the window for that. Am I missing something? I think pressing Escape should close the window and cancel the renaming.
It would be great to add an argument to vim.ui.input
to specify the default text when asking the user for input.
Hi,
I'm currently trying to add proper support for dressing.nvim
in my plugin inc-rename.nvim (the current implementation has issues, see smjonas/inc-rename.nvim#17). Basically, I need to control the window created by dressing.nvim
from the command line and change the input text while the user is typing. For this to work, I need to get the ID of the window created by vim.ui.input
.
At the moment, I am doing the following to find the ID:
-- Open the input window and find the buffer and window IDs
vim.ui.input({}, function() end)
vim.schedule(function()
for _, win_id in ipairs(vim.api.nvim_list_wins()) do
local bufnr = vim.api.nvim_win_get_buf(win_id)
if vim.bo[bufnr].filetype == "DressingInput" then
-- found the window ID
end
end
end)
This almost works but using vim.schedule
is problematic as that doesn't work well with Nvim's command preview callback. Omitting vim.schedule
won't work because you use schedule_wrap
in input.lua
here (so I need to schedule my code to run after yours):
dressing.nvim/lua/dressing/input.lua
Line 276 in 96b09a0
Therefore, I am proposing the following enhancements:
no_schedule
/ synchronous
/ sync
passed to the opts
key in vim.ui.input
which won't schedule wrap the function if set to true
(let me know which name you'd prefer)no_schedule
/ synchronous
/ sync
is set, return the window ID from vim.ui.input
Please let me know if you have any another ideas / suggestions! I can send a PR if you want :)
System information
require('dressing').setup({
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "Input:",
-- Can be 'left', 'right', or 'center'
prompt_align = "left",
-- When true, <Esc> will close the modal
insert_only = true,
-- These are passed to nvim_open_win
anchor = "SW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 80, 0.2 },
-- Window transparency (0-100)
winblend = 0,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Options for telescope selector
-- These are passed into the telescope picker directly. Can be used like:
-- telescope = require('telescope.themes').get_ivy({...})
telescope = require('telescope.themes').get_cursor({ winblend = 5 }),
-- Used to override format_item. See :help dressing-format
format_item_override = {},
-- see :help dressing_get_config
get_config = nil,
},
})
To Reproduce
Steps to reproduce the behavior:
I've tried out a few colorschemes with dressing.nvim but cant seem to find a suitably visible border and title theme.
Is it possible to change the input theme in the dressing config?
Describe the bug
A clear and concise description of what the bug is.
System information
vim.ui.select
backend? If so, which one? nuirequire('dressing').setup({
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "Input:",
-- Can be 'left', 'right', or 'center'
prompt_align = "left",
-- When true, <Esc> will close the modal
insert_only = true,
-- These are passed to nvim_open_win
anchor = "SW",
border = EcoVim.ui.float.border or "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
-- Window transparency (0-100)
winblend = 0,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
backend = { "telescope", "nui", "fzf", "builtin" },
-- Options for nui Menu
nui = {
position = {
row = 1,
col = 0,
},
size = nil,
relative = "cursor",
border = {
style = EcoVim.ui.float.border or "rounded",
text = {
top_align = "right",
},
},
max_width = 80,
max_height = 40,
},
-- see :help dressing_get_config
get_config = function(opts)
if opts.kind == 'codeaction' then
return {
backend = 'nui',
nui = {
relative = 'cursor',
max_width = 80,
}
}
end
end
},
})
To Reproduce
Steps to reproduce the behavior:
If possible, provide a minimal file that will trigger the issue (see
tests/manual
for examples of short ways to call vim.ui.*
):
Somehow it works good with test. Just breaks when using my config and code actions/rename.
Additional context
I have winbar configured with nvim 0.8 and then nui
backed stops working and each time I try to use code action with vim.ui.select or rename with vim.ui.input it throws error.
Looks like winbar is trying to be attached to nui window and it doesn't have enough space or sth like that.
I've added "DressingInput" filetype and "DressingSelect" filetype to excluded of winbar but it still doesn't work. I can tell that it works great with Telescope (which has filetype of TelescopePrompt) added to excluded filetypes.
My autocmd for winbar:
vim.api.nvim_create_autocmd({ "CursorMoved", "BufWinEnter", "BufFilePost" }, {
callback = function()
local winbar_filetype_exclude = {
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"alpha",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"TelescopePrompt",
"DressingInput",
"DressingSelect",
}
if vim.tbl_contains(winbar_filetype_exclude, vim.bo.filetype) then
vim.opt_local.winbar = nil
return
end
local value = require("winbar").gps()
if value == nil then
value = require("winbar").filename()
end
vim.opt_local.winbar = value
end,
})
I also realized that if the error shows, sometimes "Code actions" are showing and when I click enter everything seems to work fine. Just error is showing each time:
Then press enter and it shows correctly:
Same with vim.ui.input.
Does anyone else have this issue when using winbar with nui prompt?
Describe the bug
The first time I use vim.ui.select after starting Nvim, I get an error similar to the following:
Error executing vim.schedule lua callback: ...cker/start/dressing.nvim/lua/dressing/select/fzf_lua.lua:30: attempt to call a nil value
stack traceback:
...cker/start/dressing.nvim/lua/dressing/select/fzf_lua.lua:30: in function 'select'
.../packer/start/dressing.nvim/lua/dressing/select/init.lua:63: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
This was triggered by using the :lua vim.ui.select({1,2,3}, {}, function(opt)end)
command. Running the command again will work correctly
System information
vim.ui.select
backend? If so, which one? Fzf_luaTo Reproduce
Steps to reproduce the behavior:
:lua vim.ui.select({1,2,3}, {}, function(opt)end)
Additional context
I'm using the following lua plugin related to FZF:
Describe the bug
When setting up an autocmd to automatically format the buffer on save with the LSP, if there are multiple formatting capable language servers vim.ui.select
is called to select the correct one. The Telescope selection window appears but it not in focus
System information
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
vim.ui.select
backend? If so, which one? Yes, telescope
require("dressing").setup({
input = {
enabled = ui_opts.nui_input,
default_prompt = "➤ ",
winhighlight = "Normal:Normal,NormalNC:Normal",
},
select = {
enabled = ui_opts.telescope_select,
backend = { "telescope", "builtin" },
builtin = { winhighlight = "Normal:Normal,NormalNC:Normal" },
},
})
To Reproduce
Steps to reproduce the behavior:
BufWritePre
)on_attach = function(client, bufnr)
if client.resolved_capabilities.document_formatting then
vim.api.nvim_create_autocmd("BufWritePre", {
desc = "Auto format before save",
pattern = "<buffer>",
callback = function() vim.lsp.buf.formatting_sync() end,
})
end
end,
sumneko_lua
and stylua
(with null-ls
)Screenshots
Describe the bug
When opening a vim.ui.input prompt via telescope, its size is way too big.
System information
vim.ui.select
backend? If so, which one? local present, dressing = pcall(require, "dressing")
if not present then
print("dressing not found")
return
end
dressing.setup({
input = {
max_width = { 140, 0.9 },
min_width = { 10, 0.1 },
},
select = {
backend = { "telescope", "builtin" },
telescope = require('telescope.themes').get_ivy(),
builtin = {
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
},
},
To Reproduce
Steps to reproduce the behavior:
vim.ui.input
promptIf possible, provide a minimal file that will trigger the issue (see
tests/manual
for examples of short ways to call vim.ui.*
):
vim.ui.input("Enter stuff", function(stuff) print("Stuff: " .. stuff) end)
Screenshots
EDIT: I thought that vim.ui.input
was handled by telescope. It's not as I just realised.
Describe the bug
The recent telescope theme deprecation warning is shown continuously because the telescope theme object itself actually has a key called theme, so this wrongly reports that a user hasn't migrated despite having done so.
System information
vim.ui.select
backend? If so, which one? Telescopeuse {
'stevearc/dressing.nvim',
after = 'telescope.nvim',
config = function()
require('dressing').setup {
input = {
insert_only = false,
winblend = 2,
},
select = {
telescope = require('telescope.themes').get_cursor { -- <--- This function returns an object with a theme key
layout_config = {
height = function(self, _, max_lines)
local results = #self.finder.results
return (results <= max_lines and results or max_lines - 10) + 4 -- 4 is the size of the window
end,
},
},
},
}
end
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
telescope = {
borderchars = {
preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
prompt = { "─", "│", " ", "│", "╭", "╮", "│", "│" },
results = { "─", "│", "─", "│", "├", "┤", "╯", "╰" }
},
layout_config = {
height = <function 2>,
width = 80
},
layout_strategy = "cursor",
results_title = false,
sorting_strategy = "ascending",
theme = "cursor"
}
is it possible to add a new option to input configs so that the default value in the input window is automatically selected. i tried with and nvim_feedkeys
and autocmds but i couldn't get it to work
The fzf-lua floating windows have filetype fzf
.
I would love if I could use the same pop up selection menu for picking my spelling suggestions via dressing.nivm (z=
keymap).
Describe the bug
When using Telescope File Browser the Dressing UI appears behind the Telescope File Browser UI, and doesn't receive focus. Unsure if this problem is Dressing, Telescope File Browser, or my config related — usually it's me but I am just using defaults. :)
Sincere apologies in advance if it turns out to be the latter!
System information
vim.ui.select
backend? If so, which one?use({ "stevearc/dressing.nvim" })
To Reproduce
Steps to reproduce the behavior:
Screenshots
Is it possible to use a custom sorter if the kind
option is a certain value, otherwise use the default sorter?
For example, I want to be able to sort user created items to be before builtin items in my plugin legendary.nvim.
I think this could probably be done via the get_config
option of dressing.nvim
?
Following nvim-tree/nvim-tree.lua#1097, vim.ui.input
with the popup doesn't look very good on top of a NvimTree buffer. Is it possible to be able to specify default filetypes / conditions for disabling this UI tweak (e.g. just for NvimTree)?
When opening a select from normal/insert mode, the telescope UI gets used correctly. When doing a visual selection and calling vim.lsp.buf.range_code_action()
the telescope UI gets opened in normal mode, making it necessary to press <Esc>
before trying to select any option
Hi. The borders look disconnected and bad for me, but the look nice in the screenshots. What could be the issue?
Terminal: Konsole
Config: https://github.com/lumbo7332/dotfiles/tree/main/dot_config/nvim
I'm wondering if it is possible to have the vim.ui.input
popup span across buffers. I am running into an issue where the pop up is getting cut off in a small sidebar like split when there is plenty of room:
Other things like nui
have this, but I'm not sure if that's because they are separate from the vim.ui.input
. nui
example:
I use default settings and seems dont work? Nvim-8.0.0dev
With default rename I can use arrows to select previously used name. Is it possible to support this?
I've seen #1.
But I see value in having ESC exiting insert mode.
Pressing ESC again would then close the prompt.
I guess it wouldn't be too alienating for many users since this is his telescope works as well.
Ideally this would be an option which could be set in get_config
for input.
On another note, is there a filetype assigned to the input buffer which can be used to apply custom mappings?
This might not "fix" but help with #2.
Currently rename
opens nicely where the given symbol is, but code action, regardless of the chosen selector opens in the middle.
Is it possible to make it open next to the cursor, where the code action is performed, like lspsaga
does?
It would be way more convenient.
Right now plugin's vim.ui.input
defines its own completion. It seems to conflict with other external (auto-)completion functionality. This is vaguely confirmed by hard-coded 'nvim-cmp' disabling. I understand that 'nvim-cmp' is the completion engine right now, but it would be nice to at least have notice somewhere that external completion engine should be disabled in specified buffer. For example, this caused a hard-to-find behavior in 'mini.completion' (echasnovski/mini.nvim#68).
Greetings, thanks for making this plugin.
I've been trying to port one of my plugins from VimScript to Lua using vim.ui.select
and I came across the following issue: when I use any floating window via vim.ui
+ Dressing coming from an autocommand (In this specific case BufNewFile) the floating window appears but the document is actually selected and insert mode is active.
I managed to reproduce it with the following config (besides plenary, telescope and dressing as installed plugins):
lua << EOF
function test()
vim.ui.select({"echo 'Hi'"}, {}, function(item, _) if item then vim.cmd(item) end end)
end
vim.cmd([[autocmd BufNewFile * lua test()]])
EOF
I'm sorry if something I wrote is wrong, I'm not an expert in either VimScript or Lua. Seems that the standard vim.ui
works correctly, as long as i set shortmess-=F
(which doesn't help with dressing).
I'm ready to answer any question, if needed. Thank you in advance!
Hello @stevearc, smart plugin. great work.
I'm currently testing it for inputs but I fail to make the window center, relative to the buffer or the window. I wonder there is away to do this or an option available
Thanks ❤️
Hi, I'm a bit confused as to how one would re-enable completion engines such as cmp
and mini
as both are currently explicitly disabled with no option to prevent that.
Additionally and ideally there would be a hook of some sort that users can setup their completion engines within per vim.ui.input
call.
That way for example when vim.ui.input
is used to do an LSP rename, one could enable cmp
with sources that make sense in that context (buffer
, spell
, rg
.. etc) which aid in the operation of LSP renaming.
It really sounds like I'm asking for some hooks per vim.ui.input
call here but I didn't want to be vague in order to eliminate any chance of having an XY problem here.
I might be missing something obvious here, wdyt?
Is it possible to set highlights for insert/select floating windows borders and text messages?
Using dressing.nvim
and telescope-file-browser
at the same time seems to not be possible at the moment, see this issue:
nvim-telescope/telescope-file-browser.nvim#66
It seems that the issue is that dressing
triggers a BufLeave
event which closes the telescope
buffer. I'm not sure how easy that could be to fix but an alternative could maybe be to have the ability to disable dressing
under certain circumstances, eg for telescope
buffers.
Describe the bug
The following code
vim.ui.input({ prompt = 'Data: ' }, function(data) vim.notify(vim.inspect(data)) end)
prints nil
for both cancelled dialog and empty input. I would expect to have an empty string on empty input.
System information
To Reproduce
Steps to reproduce the behavior:
:vim.ui.input({ prompt = 'Data: ' }, function(data) vim.notify(vim.inspect(data)) end)
<CR>
I'd like to suggest that dressing.nvim
extends is functionality to vim.notify()
and vim.notify_once()
calls.
Describe the bug
vim.ui.input
shows listchars
eol
when the width of the text goes beyond
the available width of the input.
System information
NVIM v0.7.0-dev+1287-g315858bf6
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by lalitmee@pop-os
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
Run :checkhealth for more info
vim.ui.select
backend? If so, which one? No.-- Paste your call to require("dressing").setup(...) in here
dressing.setup({
input = { insert_only = false, winblend = 2 },
select = {
winblend = 2,
telescope = require("telescope.themes").get_cursor({
layout_config = {
-- NOTE: the limit is half the max lines because this is the cursor theme so
-- unless the cursor is at the top or bottom it realistically most often will
-- only have half the screen available
height = function(self, _, max_lines)
local results = #self.finder.results
local PADDING = 4 -- this represents the size of the telescope window
local LIMIT = math.floor(max_lines / 2)
return (results <= (LIMIT - PADDING) and results + PADDING or LIMIT)
end,
},
}),
},
})
To Reproduce
Steps to reproduce the behavior:
vim.ui.input
widthnvim-tree.lua
to rename or create a fileIf possible, provide a minimal file that will trigger the issue (see
tests/manual
for examples of short ways to call vim.ui.*
):
-- minimal code not required
Additional context
I tried to setup setlocal noeol
in the DressingInput
on the basis of Filetype
in an autocmd
but
it didn't work.
I am using a language server that I need to make a selection for before starting the server. Currently I can use the default way to select my option first and then the buffer loads. When using this plugin the buffer is not blocked from loading and I am unable to make the selection before the language server starts.
Is there anyway to expose an option to have the menu block loading a buffer until after the selection is made?
Tried the mentioned commit (that specific one) and now it does not crash, but no autocomplete happens either. I am trying the same key to trigger the autocomplete that previously was making it crash, so I guess it's the correct one
Originally posted by @danielo515 in #55 (comment)
https://gyazo.com/038fd26af21cfb8e3661c57ceab0dcf6
Sometimes when the cursor is at top, input prompt acts weird.
Inspired by this plugin, I'm experimenting with fzf#run
myself, and its terminal command returns 1
if there's an error with the command or 130
if nothing is chosen (I tested pressing both Esc and Ctrl+C).
Therefore, you can check v:event
to capture the fzf
command exit status and only run the cancel callback when the status is not 0
(or only when it's 130
depending on how you want to handle errors). You can do that in a TermClose
autocmd, instead of deferring a callback using BufLeave
.
I there any way to configure key mappings for vim.ui.input
? I would like to be able to use <C-k>
/<C-j>
to move up/down in history by mapping them to <Up>
/<Down>
.
I tried using an autocmd FileType DressingInput
to set the mappings buffer-locally but for some reason it didn't work for me. The autocommand gets triggered but the mappings don't appear.
The original input method seems compatible with the cmap
.
It would be helpful to have them here.
It would be nice if https://github.com/hood/popui.nvim is supported. I like how for code actions, that UI is very close to the source. For others, I like this plugin
In general, It would be cool if users can add custom backends very easily
After the commit cc1a3440
, the ._close
function has been deprecated. Now it just calls .close
.
I use legendary.nvim
, and when I close the telescope
prompt, I get a stack overflow.
E5108: Error executing lua ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:55: stack overflow
stack traceback:
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:55: in function '_close'
...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
...
...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'
[string ":lua"]:1: in main chunk
I've noticed that the cause of the problem are the following lines in dressing.nvim
:
actions.close:replace(function()
actions._close(prompt_bufnr, false)
on_choice(nil, nil)
end)
When the lines are deleted, everything still seems to work just fine. I'm not sure if they are needed, or need to be changed.
NVIM v0.7.0-dev+1443-gdbd5242d8
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az32-353
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/share/nvim"
Run :checkhealth for more info
require("dressing").setup {
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "➤ ",
-- When true, <Esc> will close the modal
insert_only = true,
-- These are passed to nvim_open_win
anchor = "SW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
-- Options for telescope selector
-- These are passed into the telescope picker directly. Can be used like:
-- telescope = require('telescope.themes').get_ivy({}),
telescope = require('telescope.themes').get_dropdown({}),
-- telescope = require("telescope.themes").get_cursor({}),
-- Options for fzf selector
fzf = { window = { width = 0.5, height = 0.4 } },
-- Options for fzf_lua selector
fzf_lua = { winopts = { width = 0.5, height = 0.4 } },
-- Options for nui Menu
nui = {
position = "50%",
size = nil,
relative = "editor",
border = { style = "rounded" },
max_width = 80,
max_height = 40,
},
-- Options for built-in selector
builtin = {
-- These are passed to nvim_open_win
anchor = "NW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- the min_ and max_ options can be a list of mixed types.
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
},
-- Used to override format_item. See :help dressing-format
format_item_override = {},
-- see :help dressing_get_config
get_config = nil,
},
}
Hello,
I want to use vim.ui.input()
to set path to executable for nvim-dap
. I managed to do it with default vim.ui.input()
(which simply calls vim.fn.input()
as I understand) as follows:
dap.configurations.cpp = {
{
program = function()
local path_to_program = '???'
vim.ui.input({
prompt = 'Path to executable: ',
default = vim.fn.getcwd() .. '/',
completion = 'file',
},
function(input)
path_to_program = input
end
)
return path_to_program
end,
},
}
But when I tried to use dressing.nvim
implementation of vim.ui.input()
in the same manner I faced two issues:
<cmd>lua require'dap'.continue()<cr>
popup window that serves for setting path to executable opens as expected but then it immediately closes so I cannot write anything in there.on_confirm
function changes path_to_program
variable as expected inside its scope but in the end when the variable has to be returned it equals '???' as before the change. So change of the variable inside on_confirm
does not take effect.Could you please help me to figure out how to properly use vim.ui.input()
in this case?
Edit: I use NVIM v0.6.0.
I see that there is already support for customizing the input prompt alignment, but it is currently not exposed and alignment is hard-coded as left
. Will it be eventually promoted to a public option that we can use?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.