From ff62fc28cd7976e49ddff6897a4f870785187f13 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Sun, 20 Aug 2023 05:10:09 +0000 Subject: [PATCH] fix: sometimes use shell to run trash command (#99) --- lua/oil/adapters/files/trash.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/oil/adapters/files/trash.lua b/lua/oil/adapters/files/trash.lua index 37769f7..5236f5b 100644 --- a/lua/oil/adapters/files/trash.lua +++ b/lua/oil/adapters/files/trash.lua @@ -4,7 +4,12 @@ local M = {} M.recursive_delete = function(path, cb) local stdout = {} local stderr = {} - local cmd = vim.list_extend(vim.split(config.trash_command, "%s+"), { path }) + local cmd + if config.trash_command:find("%s") then + cmd = string.format("%s %s", config.trash_command, vim.fn.shellescape(path)) + else + cmd = { config.trash_command, path } + end local jid = vim.fn.jobstart(cmd, { stdout_buffered = true, stderr_buffered = true,