summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/files.lua
diff options
context:
space:
mode:
authorKhalid <khalid97262@live.com>2021-05-08 15:02:18 +0300
committerGitHub <noreply@github.com>2021-05-08 14:02:18 +0200
commit25a7ecc289dffaa3d45870b452fa1bfb83253ba9 (patch)
tree95b29e4c59d659f08de7e0f01d2e4e8f79ea981a /lua/telescope/builtin/files.lua
parent1408e3bbb7b1cdb048ddaebe66a04926c6d4bf74 (diff)
feat: add use_regex option to grep_string (#767)
Diffstat (limited to 'lua/telescope/builtin/files.lua')
-rw-r--r--lua/telescope/builtin/files.lua4
1 files changed, 3 insertions, 1 deletions
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("<cword>"))
+ local word = opts.search or vim.fn.expand("<cword>")
+ 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)