Allow to parse search phrase in quotes "as is"
mambusskruj opened this issue · 3 comments
mambusskruj commented
Let's say I want to search for parameter --jobs
in files. And for that I need to escape dashes with backslashes even while I use quotes for search phrase (like this "\-\-jobs"
).
So I propose to parse characters "as is" in quotes for search phrase.
Example: for "--jobs"
prompt -> search phrase will be --jobs
notpeelz commented
rg "--jobs"
is the same as rg --jobs
, which results in this error:
error: Found argument '--jobs' which wasn't expected, or isn't valid in this context
You need to tell the program to stop parsing the options list, i.e. rg -- --jobs
You can use this function instead of the default quote_prompt
:
local action_state = require("telescope.actions.state")
local function quote_prompt(bufnr)
local picker = action_state.get_current_picker(bufnr)
local prompt = picker:_get_prompt()
prompt = vim.trim(prompt)
prompt = "-- \"" .. prompt:gsub("\"", "\\\"") .. "\""
picker:set_prompt(prompt)
vim.cmd.normal{ "I", bang = true }
end
lga.mp4
mambusskruj commented
@notpeelz wow, thank you so much!
weeman1337 commented
I have re-opened the issue. Searching for --jobs
should work. The comment is a possible workaround. I will take a look and add something to the plugin.