From 57a23321a2bbb92dc75f05bcd11b0ccb52932931 Mon Sep 17 00:00:00 2001 From: Michael Sartain Date: Fri, 25 Mar 2022 21:30:08 -0600 Subject: [PATCH] Add ripgrep options support to glob_parse https://github.com/ibhagwan/fzf-lua/issues/373 --- lua/fzf-lua/make_entry.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/fzf-lua/make_entry.lua b/lua/fzf-lua/make_entry.lua index 4c72da26..e25fff00 100644 --- a/lua/fzf-lua/make_entry.lua +++ b/lua/fzf-lua/make_entry.lua @@ -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