Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prompt_parse_fun option #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ telescope.setup {
-- theme = "dropdown", -- use dropdown theme
-- theme = { }, -- use own theme spec
-- layout_config = { mirror=true }, -- mirror preview pane

-- custom prompt parse function
-- prompt_parse_fun = function(prompt, autoquote) … end,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions lua/telescope/_extensions/live_grep_args.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ local live_grep_args = function(opts)
opts.vimgrep_arguments = opts.vimgrep_arguments or conf.vimgrep_arguments
opts.entry_maker = opts.entry_maker or make_entry.gen_from_vimgrep(opts)
opts.cwd = opts.cwd and vim.fn.expand(opts.cwd)
opts.prompt_parse_fun = opts.prompt_parse_fun or prompt_parser.parse

local cmd_generator = function(prompt)
if not prompt or prompt == "" then
return nil
end

local args = tbl_clone(opts.vimgrep_arguments)
local prompt_parts = prompt_parser.parse(prompt, opts.auto_quoting)

local prompt_parts = opts.prompt_parse_fun(prompt, opts.auto_quoting)
local cmd = vim.tbl_flatten { args, prompt_parts }
return cmd
end
Expand Down