Skip to content

Commit 3a598c1

Browse files
committed
fix: search selection respect search backend.
1 parent 4183645 commit 3a598c1

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

lua/keymap/tool.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,21 @@ local mappings = {
132132
:with_silent()
133133
:with_desc("tool: Find patterns"),
134134
["v|<leader>fs"] = map_callback(function()
135-
local default_opts = "--column --line-number --no-heading --color=always --smart-case"
136-
local opts = vim.fn.getcwd() == vim_path and default_opts .. " --no-ignore --hidden --glob '!.git/*'"
137-
or ""
138-
local text = require("fzf-lua.utils").get_visual_selection()
139-
require("fzf-lua").grep_project({
140-
search = text,
141-
rg_opts = opts,
142-
})
135+
local search_backend = require("core.settings").search_backend
136+
if search_backend == "fzf" then
137+
local default_opts = "--column --line-number --no-heading --color=always --smart-case"
138+
local opts = vim.fn.getcwd() == vim_path
139+
and default_opts .. " --no-ignore --hidden --glob '!.git/*'"
140+
or ""
141+
local text = require("fzf-lua.utils").get_visual_selection()
142+
require("fzf-lua").grep_project({
143+
search = text,
144+
rg_opts = opts,
145+
})
146+
else
147+
local opts = vim.fn.getcwd() == vim_path and { additional_args = { "--no-ignore" } } or {}
148+
require("telescope-live-grep-args.shortcuts").grep_visual_selection(opts)
149+
end
143150
end)
144151
:with_noremap()
145152
:with_silent()

0 commit comments

Comments
 (0)