cleanup: remove deprecated trash_command

This commit is contained in:
Steven Arcangeli 2026-01-01 00:22:21 -05:00
parent 78ed0cf7d9
commit 81b8a91735
4 changed files with 2 additions and 62 deletions

View file

@ -4,6 +4,7 @@ on:
push: push:
branches: branches:
- master - master
- stevearc-*
pull_request: pull_request:
branches: branches:
- master - master

View file

@ -6,7 +6,6 @@ local fs = require("oil.fs")
local git = require("oil.git") local git = require("oil.git")
local log = require("oil.log") local log = require("oil.log")
local permissions = require("oil.adapters.files.permissions") local permissions = require("oil.adapters.files.permissions")
local trash = require("oil.adapters.files.trash")
local util = require("oil.util") local util = require("oil.util")
local uv = vim.uv or vim.loop local uv = vim.uv or vim.loop
@ -620,15 +619,7 @@ M.perform_action = function(action, cb)
end end
if config.delete_to_trash then if config.delete_to_trash then
if config.trash_command then
vim.notify_once(
"Oil now has native support for trash. Remove the `trash_command` from your config to try it out!",
vim.log.levels.WARN
)
trash.recursive_delete(path, cb)
else
require("oil.adapters.trash").delete_to_trash(path, cb) require("oil.adapters.trash").delete_to_trash(path, cb)
end
else else
fs.recursive_delete(action.entry_type, path, cb) fs.recursive_delete(action.entry_type, path, cb)
end end

View file

@ -1,44 +0,0 @@
local config = require("oil.config")
local M = {}
M.recursive_delete = function(path, cb)
local stdout = {}
local stderr = {}
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,
on_stdout = function(j, output)
stdout = output
end,
on_stderr = function(j, output)
stderr = output
end,
on_exit = function(j, exit_code)
if exit_code == 0 then
cb()
else
cb(
string.format(
"Error moving '%s' to trash:\n stdout: %s\n stderr: %s",
path,
table.concat(stdout, "\n "),
table.concat(stderr, "\n ")
)
)
end
end,
})
if jid == 0 then
cb(string.format("Passed invalid argument '%s' to '%s'", path, config.trash_command))
elseif jid == -1 then
cb(string.format("'%s' is not executable", config.trash_command))
end
end
return M

View file

@ -224,7 +224,6 @@ default_config.view_options.highlight_filename = nil
---@class oil.Config ---@class oil.Config
---@field adapters table<string, string> Hidden from SetupOpts ---@field adapters table<string, string> Hidden from SetupOpts
---@field adapter_aliases table<string, string> Hidden from SetupOpts ---@field adapter_aliases table<string, string> Hidden from SetupOpts
---@field trash_command? string Deprecated option that we should clean up soon
---@field silence_scp_warning? boolean Undocumented option ---@field silence_scp_warning? boolean Undocumented option
---@field default_file_explorer boolean ---@field default_file_explorer boolean
---@field columns oil.ColumnSpec[] ---@field columns oil.ColumnSpec[]
@ -403,13 +402,6 @@ local M = {}
M.setup = function(opts) M.setup = function(opts)
opts = opts or {} opts = opts or {}
if opts.trash_command then
vim.notify(
"[oil.nvim] trash_command is deprecated. Use built-in trash functionality instead (:help oil-trash).\nCompatibility will be removed on 2025-06-01.",
vim.log.levels.WARN
)
end
local new_conf = vim.tbl_deep_extend("keep", opts, default_config) local new_conf = vim.tbl_deep_extend("keep", opts, default_config)
if not new_conf.use_default_keymaps then if not new_conf.use_default_keymaps then
new_conf.keymaps = opts.keymaps or {} new_conf.keymaps = opts.keymaps or {}