fix(fzf-lua): add separator after prompt (#145)

* feat(fzf-lua): add an input indicator after prompt

* refactor: only use '>' as separator if ':' is not being used

---------

Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
This commit is contained in:
Yi Ming 2024-03-13 11:16:43 +08:00 committed by GitHub
parent 6f21226206
commit 18e5beb384
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,16 @@ M.is_supported = function()
end end
M.select = function(config, items, opts, on_choice) M.select = function(config, items, opts, on_choice)
if opts.prompt then
-- If we're not using ":" as the separator, use ">"
if not vim.endswith(opts.prompt, ":") then
opts.prompt = opts.prompt .. ">"
end
-- Ensure there is some whitespace between the prompt and input
if not vim.endswith(opts.prompt, " ") then
opts.prompt = opts.prompt .. " "
end
end
local ui_select = require("fzf-lua.providers.ui_select") local ui_select = require("fzf-lua.providers.ui_select")
if config and not vim.tbl_isempty(config) then if config and not vim.tbl_isempty(config) then
-- Registering then unregistering sets the config options -- Registering then unregistering sets the config options