avoid shadowing lua's error function

remotes/origin/HEAD
pseudometa 2022-11-28 16:53:02 +01:00
parent a458dadc32
commit 49eb08a38f
1 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
local M = {} local M = {}
local error = vim.log.levels.ERROR local logError = vim.log.levels.ERROR
local expand = vim.fn.expand local expand = vim.fn.expand
local fn = vim.fn local fn = vim.fn
local cmd = vim.cmd local cmd = vim.cmd
@ -47,9 +47,9 @@ local function fileOp(op)
fn.setreg("z", prevReg) -- restore register content fn.setreg("z", prevReg) -- restore register content
end end
if invalidName then if invalidName then
vim.notify(" Invalid filename. ", error) vim.notify(" Invalid filename. ", logError)
elseif sameName then elseif sameName then
vim.notify(" Cannot use the same filename. ", error) vim.notify(" Cannot use the same filename. ", logError)
end end
return return
end end
@ -70,7 +70,7 @@ local function fileOp(op)
cmd("bdelete #") cmd("bdelete #")
vim.notify(" Renamed '" .. oldName .. "' to '" .. newName .. "'. ") vim.notify(" Renamed '" .. oldName .. "' to '" .. newName .. "'. ")
else else
vim.notify(" Could not rename file: " .. errormsg, error) vim.notify(" Could not rename file: " .. errormsg, logError)
end end
elseif op == "new" or op == "newFromSel" then elseif op == "new" or op == "newFromSel" then
cmd {cmd = "edit", args = {filepath}} cmd {cmd = "edit", args = {filepath}}
@ -148,7 +148,7 @@ function M.trashFile(opts)
cmd [[bdelete]] cmd [[bdelete]]
vim.notify(" '" .. filename .. "' deleted. ") vim.notify(" '" .. filename .. "' deleted. ")
else else
vim.notify(" Could not delete file: " .. errormsg, error) vim.notify(" Could not delete file: " .. errormsg, logError)
end end
end end