From 25a7ecc289dffaa3d45870b452fa1bfb83253ba9 Mon Sep 17 00:00:00 2001 From: Khalid Date: Sat, 8 May 2021 15:02:18 +0300 Subject: [PATCH] feat: add use_regex option to grep_string (#767) --- lua/telescope/builtin/files.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index f9c3ed9..d77895a 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -97,12 +97,14 @@ end -- Special keys: -- opts.search -- the string to search. -- opts.search_dirs -- list of directory to search in +-- opts.use_regex -- special characters won't be escaped files.grep_string = function(opts) -- TODO: This should probably check your visual selection as well, if you've got one local vimgrep_arguments = opts.vimgrep_arguments or conf.vimgrep_arguments local search_dirs = opts.search_dirs - local search = escape_chars(opts.search or vim.fn.expand("")) + local word = opts.search or vim.fn.expand("") + local search = opts.use_regex and word or escape_chars(word) local word_match = opts.word_match opts.entry_maker = opts.entry_maker or make_entry.gen_from_vimgrep(opts)