diff --git a/lua/fzf-lua/providers/tags.lua b/lua/fzf-lua/providers/tags.lua index 5dca6340..edda3b38 100644 --- a/lua/fzf-lua/providers/tags.lua +++ b/lua/fzf-lua/providers/tags.lua @@ -233,13 +233,16 @@ end M.grep_cword = function(opts) if not opts then opts = {} end - opts.search = vim.fn.expand("") + opts.no_esc = true + opts.search = [[\b]] .. utils.rg_escape(vim.fn.expand("")) .. [[\b]] return M.grep(opts) end M.grep_cWORD = function(opts) if not opts then opts = {} end - opts.search = vim.fn.expand("") + opts.no_esc = true + -- since we're searching a tags file also search for surrounding literals ^ $ + opts.search = [[(^|\^|\s)]] .. utils.rg_escape(vim.fn.expand("")) .. [[($|\$|\s)]] return M.grep(opts) end