@@ -100,8 +100,7 @@ local mappings = {
100100
101101 -- Plugin: telescope
102102 [" n|<C-p>" ] = map_callback (function ()
103- local search_backend = require (" core.settings" ).search_backend
104- if search_backend == " fzf" then
103+ if require (" core.settings" ).search_backend == " fzf" then
105104 local prompt_position = require (" telescope.config" ).values .layout_config .horizontal .prompt_position
106105 require (" fzf-lua" ).keymaps ({
107106 fzf_opts = { [" --layout" ] = prompt_position == " top" and " reverse" or " default" },
@@ -132,20 +131,17 @@ local mappings = {
132131 :with_silent ()
133132 :with_desc (" tool: Find patterns" ),
134133 [" v|<leader>fs" ] = map_callback (function ()
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 ()
134+ local is_config = vim .uv .cwd () == vim_path
135+ if require (" core.settings" ).search_backend == " fzf" then
142136 require (" fzf-lua" ).grep_project ({
143- search = text ,
144- rg_opts = opts ,
137+ search = require (" fzf-lua.utils" ).get_visual_selection (),
138+ rg_opts = " --column --line-number --no-heading --color=always --smart-case"
139+ .. (is_config and " --no-ignore --hidden --glob '!.git/*'" or " " ),
145140 })
146141 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 )
142+ require (" telescope-live-grep-args.shortcuts" ).grep_visual_selection (
143+ is_config and { additional_args = { " --no-ignore" } } or {}
144+ )
149145 end
150146 end )
151147 :with_noremap ()
@@ -174,8 +170,7 @@ local mappings = {
174170 :with_silent ()
175171 :with_desc (" tool: Resume last search" ),
176172 [" n|<leader>fR" ] = map_callback (function ()
177- local search_backend = require (" core.settings" ).search_backend
178- if search_backend == " fzf" then
173+ if require (" core.settings" ).search_backend == " fzf" then
179174 require (" fzf-lua" ).resume ()
180175 end
181176 end )
0 commit comments