From ac03f495c6ec1f832488556969f72677b69ef33d Mon Sep 17 00:00:00 2001 From: gavynriebau Date: Thu, 16 Sep 2021 18:02:24 +0800 Subject: [PATCH] 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. --- lua/telescope/actions/set.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/telescope/actions/set.lua b/lua/telescope/actions/set.lua index dc04040..320addd 100644 --- a/lua/telescope/actions/set.lua +++ b/lua/telescope/actions/set.lua @@ -131,7 +131,7 @@ action_set.edit = function(prompt_bufnr, command) -- prevents restarting lsp server if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then 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