feat: config option for trashing deleted files (#99)
This commit is contained in:
parent
339ade9dc3
commit
496d60fcff
3 changed files with 53 additions and 1 deletions
|
|
@ -28,6 +28,8 @@ local default_config = {
|
|||
restore_win_options = true,
|
||||
-- Skip the confirmation popup for simple operations
|
||||
skip_confirm_for_simple_edits = false,
|
||||
-- Deleted files will be removed with the `trash-put` command.
|
||||
delete_to_trash = false,
|
||||
-- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap
|
||||
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
|
||||
-- Additionally, if it is a string that matches "actions.<name>",
|
||||
|
|
@ -130,6 +132,14 @@ M.setup = function(opts)
|
|||
new_conf.keymaps = opts.keymaps or {}
|
||||
end
|
||||
|
||||
if new_conf.delete_to_trash and vim.fn.executable("trash-put") == 0 then
|
||||
vim.notify(
|
||||
"oil.nvim: delete_to_trash is true, but trash-put executable not found.\nDeleted files will be permanently removed.",
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
new_conf.delete_to_trash = false
|
||||
end
|
||||
|
||||
for k, v in pairs(new_conf) do
|
||||
M[k] = v
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue