@@ -202,9 +202,18 @@ M.preprocess = function(opts)
202
202
end
203
203
end
204
204
205
+ -- For custom command transformations (#1927)
206
+ opts .fn_transform_cmd =
207
+ load_config_section (" __resume_data.opts.fn_transform_cmd" , " function" , true )
208
+
205
209
-- did the caller request rg with glob support?
206
210
-- manipulation needs to be done before the argv replacement
207
- if opts .rg_glob then
211
+ if opts .fn_transform_cmd then
212
+ local query = argv (nil , opts .debug )
213
+ local new_cmd , new_query = opts .fn_transform_cmd (query , opts .cmd :gsub (argvz , " " ), opts )
214
+ opts .cmd = new_cmd or opts .cmd
215
+ opts .cmd = opts .cmd :gsub (argvz , libuv .shellescape (new_query or query ))
216
+ elseif opts .rg_glob then
208
217
local query = argv (nil , opts .debug )
209
218
local search_query , glob_args = M .glob_parse (query , opts )
210
219
if glob_args then
@@ -219,14 +228,6 @@ M.preprocess = function(opts)
219
228
end
220
229
end
221
230
222
- -- For custom command transformations (#1927)
223
- opts .fn_transform_cmd =
224
- load_config_section (" __resume_data.opts.fn_transform_cmd" , " function" , true )
225
- if opts .fn_transform_cmd then
226
- local query = argv (nil , opts .debug )
227
- opts .cmd = opts .fn_transform_cmd (query , opts .cmd :gsub (" {argv.*}" , " " ) ,opts )
228
- end
229
-
230
231
-- nifty hack to avoid having to double escape quotations
231
232
-- see my comment inside 'live_grep' initial_command code
232
233
if opts .argv_expr then
0 commit comments