summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorgavynriebau <gavyn.riebau@gmail.com>2021-09-16 18:02:24 +0800
committerGitHub <noreply@github.com>2021-09-16 12:02:24 +0200
commitac03f495c6ec1f832488556969f72677b69ef33d (patch)
tree193606e675d9714d637701b58c3919a62020152a /lua
parent5f0ccf1346b99d6d0dab7850184f128e7926cf5f (diff)
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.
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/actions/set.lua2
1 files changed, 1 insertions, 1 deletions
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