Merge pull request #41 from axieax/trim-prompt-colon

feat: trim trailing colon from prompt
This commit is contained in:
Steven Arcangeli 2022-05-30 16:24:55 -07:00 committed by GitHub
commit 0087ad7f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -165,6 +165,9 @@ require('dressing').setup({
-- 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({...})

View File

@ -47,6 +47,9 @@ local default_config = {
-- 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({...})

View File

@ -36,6 +36,10 @@ return vim.schedule_wrap(function(items, opts, on_choice)
end
opts.prompt = opts.prompt or "Select one of:"
if config.trim_prompt and opts.prompt:sub(-1, -1) == ":" then
opts.prompt = opts.prompt:sub(1, -2)
end
local format_override = config.format_item_override[opts.kind]
if format_override then
opts.format_item = format_override