Skip to content

Commit a20539f

Browse files
phanenibhagwan
authored andcommitted
fix(actions): argdel only accept relative path
feat(actions): always argdedupe after arg_add
1 parent 6488ada commit a20539f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lua/fzf-lua/actions.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ M.vimcmd_entry = function(_vimcmd, selected, opts, pcall_vimcmd)
211211
-- Force full paths when `autochdir=true` (#882)
212212
vimcmd = string.format("%s %s", vimcmd, (function()
213213
-- `:argdel|:argadd` uses only paths
214-
if vimcmd:match("^arg") then return entry.path end
214+
-- argdel only accepts relative path (#1949)
215+
if vimcmd:match("^arg") then return path.relative_to(entry.path, uv.cwd()) end
215216
if entry.bufnr then return tostring(entry.bufnr) end
216217
-- We normalize the path or Windows will fail with directories starting
217218
-- with special characters, for example "C:\app\(web)" will be translated
@@ -431,6 +432,8 @@ end
431432
M.arg_add = function(selected, opts)
432433
local vimcmd = "argadd"
433434
M.vimcmd_entry(vimcmd, selected, opts)
435+
---@diagnostic disable-next-line: param-type-mismatch
436+
pcall(vim.cmd, "argdedupe")
434437
end
435438

436439
M.arg_del = function(selected, opts)

0 commit comments

Comments
 (0)