fix: wrap vim.cmd in pcall to avoid error (#1247)
When opening a file under swap from the "fd" finder results an error was printed after the file was opened, wrapping the call to "vim.cmd" in a pcall avoids the error.
This commit is contained in:
@@ -131,7 +131,7 @@ action_set.edit = function(prompt_bufnr, command)
|
|||||||
-- prevents restarting lsp server
|
-- prevents restarting lsp server
|
||||||
if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then
|
if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then
|
||||||
filename = Path:new(vim.fn.fnameescape(filename)):normalize(vim.loop.cwd())
|
filename = Path:new(vim.fn.fnameescape(filename)):normalize(vim.loop.cwd())
|
||||||
vim.cmd(string.format("%s %s", command, filename))
|
pcall(vim.cmd, string.format("%s %s", command, filename))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user