Skip to content

Commit 4677ae9

Browse files
phanenibhagwan
authored andcommitted
fix: don't use unused {+} to avoid {+} is not expand when there's no match
1 parent df5f134 commit 4677ae9

6 files changed

Lines changed: 22 additions & 32 deletions

File tree

lua/fzf-lua/providers/buffers.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,8 @@ M.buffers = function(opts)
199199
end
200200

201201
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
202-
local reload, id = shell.reload_action_cmd(opts, "{+}")
203-
local contents = reload:gsub("%-%-%s+{%+}$", "")
204-
opts.__reload_cmd = reload
202+
local contents, id = shell.reload_action_cmd(opts, "")
203+
opts.__reload_cmd = contents
205204

206205
-- get current tab/buffer/previous buffer
207206
-- save as a func ref for resume to reuse
@@ -440,9 +439,8 @@ M.tabs = function(opts)
440439
end
441440

442441
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
443-
local reload, id = shell.reload_action_cmd(opts, "{+}")
444-
local contents = reload:gsub("%-%-%s+{%+}$", "")
445-
opts.__reload_cmd = reload
442+
local contents, id = shell.reload_action_cmd(opts, "")
443+
opts.__reload_cmd = contents
446444

447445
-- get current tab/buffer/previous buffer
448446
-- save as a func ref for resume to reuse

lua/fzf-lua/providers/colorschemes.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,8 @@ M.awesome_colorschemes = function(opts)
490490
end
491491

492492
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
493-
local reload, id = shell.reload_action_cmd(opts, "{+}")
494-
local contents = reload:gsub("%-%-%s+{%+}$", "")
495-
opts.__reload_cmd = reload
493+
local contents, id = shell.reload_action_cmd(opts, "")
494+
opts.__reload_cmd = contents
496495

497496
opts._fn_pre_fzf = function()
498497
shell.set_protected(id)

lua/fzf-lua/providers/dap.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ M.breakpoints = function(opts)
117117
end
118118

119119
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
120-
local reload, id = shell.reload_action_cmd(opts, "{+}")
121-
local contents = reload:gsub("%-%-%s+{%+}$", "")
122-
opts.__reload_cmd = reload
120+
local contents, id = shell.reload_action_cmd(opts, "")
121+
opts.__reload_cmd = contents
123122

124123
opts._fn_pre_fzf = function()
125124
shell.set_protected(id)

lua/fzf-lua/providers/files.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ M.args = function(opts)
138138
end
139139

140140
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
141-
local reload, id = shell.reload_action_cmd(opts, "{+}")
142-
local contents = reload:gsub("%-%-%s+{%+}$", "")
143-
opts.__reload_cmd = reload
141+
local contents, id = shell.reload_action_cmd(opts, "")
142+
opts.__reload_cmd = contents
144143

145144
opts._fn_pre_fzf = function()
146145
shell.set_protected(id)
@@ -162,7 +161,7 @@ M.zoxide = function(opts)
162161
-- we always require processing
163162
opts.requires_processing = true
164163

165-
local contents
164+
local contents, id
166165
if opts.multiprocess then
167166
opts.__mt_transform = [[return require("fzf-lua.make_entry").zoxide]]
168167
contents = core.mt_cmd_wrapper(opts)
@@ -177,9 +176,8 @@ M.zoxide = function(opts)
177176
end
178177

179178
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
180-
local reload, id = shell.reload_action_cmd(opts, "{+}")
181-
contents = reload:gsub("%-%-%s+{%+}$", "")
182-
opts.__reload_cmd = reload
179+
contents, id = shell.reload_action_cmd(opts, "")
180+
opts.__reload_cmd = contents
183181

184182
opts._fn_pre_fzf = function()
185183
shell.set_protected(id)

lua/fzf-lua/providers/git.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ M.status = function(opts)
4747
-- we always require processing (can't send the raw command to fzf)
4848
opts.requires_processing = true
4949

50-
local contents
50+
local contents, id
5151
if opts.multiprocess then
5252
-- git status does not require preprocessing if not loading devicons
5353
-- opts.__mt_preprocess = opts.file_icons
@@ -72,9 +72,8 @@ M.status = function(opts)
7272
end
7373

7474
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
75-
local reload, id = shell.reload_action_cmd(opts, "{+}")
76-
contents = reload:gsub("%-%-%s+{%+}$", "")
77-
opts.__reload_cmd = reload
75+
contents, id = shell.reload_action_cmd(opts, "")
76+
opts.__reload_cmd = contents
7877

7978
-- when the action resumes the preview re-attaches which registers
8079
-- a new shell function id, done enough times it will overwrite the
@@ -270,9 +269,8 @@ M.stash = function(opts)
270269
end
271270

272271
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
273-
local reload, id = shell.reload_action_cmd(opts, "{+}")
274-
local contents = reload:gsub("%-%-%s+{%+}$", "")
275-
opts.__reload_cmd = reload
272+
local contents, id = shell.reload_action_cmd(opts, "")
273+
opts.__reload_cmd = contents
276274

277275
opts._fn_pre_fzf = function()
278276
shell.set_protected(id)

lua/fzf-lua/providers/nvim.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,8 @@ M.marks = function(opts)
255255
end
256256

257257
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
258-
local reload, id = shell.reload_action_cmd(opts, "{+}")
259-
local contents = reload:gsub("%-%-%s+{%+}$", "")
260-
opts.__reload_cmd = reload
258+
local contents, id = shell.reload_action_cmd(opts, "")
259+
opts.__reload_cmd = contents
261260

262261
opts._fn_pre_fzf = function()
263262
shell.set_protected(id)
@@ -504,9 +503,8 @@ M.nvim_options = function(opts)
504503
end
505504

506505
-- build the "reload" cmd and remove '-- {+}' from the initial cmd
507-
local reload, id = shell.reload_action_cmd(opts, "{+}")
508-
local contents = reload:gsub("%-%-%s+{%+}$", "")
509-
opts.__reload_cmd = reload
506+
local contents, id = shell.reload_action_cmd(opts, "")
507+
opts.__reload_cmd = contents
510508

511509
opts._fn_pre_fzf = function()
512510
shell.set_protected(id)

0 commit comments

Comments
 (0)