Replace deprecated vim.loop API with vim.uv

This commit is contained in:
2026-02-02 20:54:28 +00:00
parent 00b5d44396
commit ff14f16bbd

View File

@@ -52,7 +52,7 @@ vim.api.nvim_create_user_command('Remove', function(opts)
end end
end end
-- Actually remove the file using the selected callback. -- Actually remove the file using the selected callback.
vim.loop.fs_unlink(path, callback) vim.uv.fs_unlink(path, callback)
end, { bang = true }) end, { bang = true })
-- :Move the file associated with the current buffer -- :Move the file associated with the current buffer
@@ -62,7 +62,7 @@ vim.api.nvim_create_user_command('Move', function(opts)
if vim.fn.isdirectory(dest) ~= 0 then if vim.fn.isdirectory(dest) ~= 0 then
dest = vim.fn.resolve(dest .. '/' .. vim.fn.expand('%:t')) dest = vim.fn.resolve(dest .. '/' .. vim.fn.expand('%:t'))
end end
vim.loop.fs_rename(source, dest, function(err, success) vim.uv.fs_rename(source, dest, function(err, success)
if success then if success then
vim.schedule(function() vim.schedule(function()
vim.cmd.edit(dest) vim.cmd.edit(dest)
@@ -87,7 +87,7 @@ vim.api.nvim_create_user_command('Rename', function(opts)
dest = vim.fn.resolve(dir .. '/' .. opts.args) dest = vim.fn.resolve(dir .. '/' .. opts.args)
end end
local buffer = vim.api.nvim_get_current_buf() local buffer = vim.api.nvim_get_current_buf()
vim.loop.fs_rename(source, dest, function(err, success) vim.uv.fs_rename(source, dest, function(err, success)
if not success then if not success then
error(err) error(err)
else else