mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 19:28:24 +00:00
feat(rename): add old
to on_rename
callback
This commit is contained in:
parent
969608ab79
commit
455228ed3a
2 changed files with 5 additions and 2 deletions
|
@ -148,6 +148,9 @@ function M.files(opts, ctx)
|
|||
if not cmd then
|
||||
return function() end
|
||||
end
|
||||
if opts.debug.files then
|
||||
Snacks.notify(cmd .. " " .. table.concat(args or {}, " "))
|
||||
end
|
||||
return require("snacks.picker.source.proc").proc({
|
||||
opts,
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ end
|
|||
|
||||
-- Prompt for the new filename,
|
||||
-- do the rename, and trigger LSP handlers
|
||||
---@param opts? {file?: string, on_rename?: fun(file:string)}
|
||||
---@param opts? {file?: string, on_rename?: fun(new:string, old:string)}
|
||||
function M.rename_file(opts)
|
||||
opts = opts or {}
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
|
@ -48,7 +48,7 @@ function M.rename_file(opts)
|
|||
vim.api.nvim_buf_delete(buf, { force = true })
|
||||
vim.fn.delete(old)
|
||||
if opts.on_rename then
|
||||
opts.on_rename(new)
|
||||
opts.on_rename(new, old)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue