Skip to content

Commit

Permalink
Add ripgrep options support to glob_parse
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesart committed Mar 26, 2022
1 parent 97a63e6 commit 57a2332
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lua/fzf-lua/make_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,21 @@ M.glob_parse = function(opts, query)
if not query or not query:find(opts.glob_separator) then
return query, nil
end
local is_type = false
local glob_args = ""
local search_query, glob_str = query:match("(.*)"..opts.glob_separator.."(.*)")
for _, s in ipairs(utils.strsplit(glob_str, "%s")) do
glob_args = glob_args .. ("%s %s ")
:format(opts.glob_flag, vim.fn.shellescape(s))
if is_type == true then
glob_args = glob_args .. '-t ' .. s .. ' '
is_type = false
elseif s == '-t' then
is_type = true
elseif string.match(s, '^-%a$') then
glob_args = glob_args .. s .. ' '
else
glob_args = glob_args .. ("%s %s ")
:format(opts.glob_flag, vim.fn.shellescape(s))
end
end
return search_query, glob_args
end
Expand Down

0 comments on commit 57a2332

Please sign in to comment.