@@ -134,37 +134,57 @@ M.live_grep = function(opts)
134134 if not opts then return end
135135
136136 -- register opts._cmd, toggle_ignore/title_flag
137- get_grep_cmd (opts , core .fzf_query_placeholder , 2 )
137+ local cmd0 = get_grep_cmd (opts , core .fzf_query_placeholder , 2 )
138138
139- -- since we're using function contents force multiprocess
140- opts .multiprocess = opts .multiprocess == 1 and true or opts .multiprocess
139+ -- if multiprocess is optional (=1) and no prpocessing is required
140+ -- use string contents (shell command), stringify_mt will use the
141+ -- command as is without the neovim headless wrapper
142+ local contents
143+ if opts .multiprocess == 1
144+ and not opts .fn_transform
145+ and not opts .fn_preprocess
146+ and not opts .fn_postprocess
147+ then
148+ contents = cmd0
149+ else
150+ -- since we're using function contents force multiprocess if optional
151+ opts .multiprocess = opts .multiprocess == 1 and true or opts .multiprocess
152+ contents = function (s , o )
153+ return FzfLua .make_entry .lgrep (s , o )
154+ end
155+ end
141156
142157 -- search query in header line
143158 opts = core .set_title_flags (opts , { " cmd" , " live" })
144159 opts = core .set_fzf_field_index (opts )
145- --- @diagnostic disable-next-line : redefined-local
146- core .fzf_live (function (s , opts )
147- return FzfLua .make_entry .lgrep (s , opts )
148- end , opts )
160+ core .fzf_live (contents , opts )
149161end
150162
151163M .live_grep_native = function (opts )
164+ -- set opts before normalize so they're saved in `__call_opts` for resume
165+ -- nullifies fn_{pre|post|transform}, forces no wrap shell.stringify_mt
166+ opts = vim .tbl_deep_extend (" force" , opts or {}, {
167+ multiprocess = 1 ,
168+ git_icons = false ,
169+ file_icons = false ,
170+ file_ignore_patterns = false ,
171+ strip_cwd_prefix = false ,
172+ path_shorten = false ,
173+ formatter = false ,
174+ multiline = false ,
175+ rg_glob = false ,
176+ })
177+
152178 opts = normalize_live_grep_opts (opts )
153179 if not opts then return end
154180
155- -- force no wrap shell.stringify_mt
156- opts .multiprocess = 1
157- opts .fn_transform = false
158- opts .fn_preprocess = false
159- opts .fn_postprocess = false
181+ -- verify settings for shell command with multiprocess native fallback
182+ assert ( opts .multiprocess = = 1
183+ and not opts .fn_transform
184+ and not opts .fn_preprocess
185+ and not opts .fn_postprocess )
160186
161- -- register opts._cmd, toggle_ignore/title_flag
162- local cmd0 = get_grep_cmd (opts , core .fzf_query_placeholder , 2 )
163-
164- -- search query in header line
165- opts = core .set_title_flags (opts , { " cmd" , " live" })
166- opts = core .set_fzf_field_index (opts )
167- core .fzf_live (cmd0 , opts )
187+ M .live_grep (opts )
168188end
169189
170190M .live_grep_glob = function (opts )
0 commit comments