Skip to content

Commit

Permalink
feat: trim trailing colon from prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
axieax committed May 30, 2022
1 parent b2406a0 commit 59cd93b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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({...})
Expand Down
3 changes: 3 additions & 0 deletions lua/dressing/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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({...})
Expand Down
4 changes: 4 additions & 0 deletions lua/dressing/select/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 59cd93b

Please sign in to comment.