From 5f5fc3aa75e9fc824d4fbbb5de31f172b43f620d Mon Sep 17 00:00:00 2001 From: Pou Yan Date: Thu, 29 Feb 2024 19:59:47 +0800 Subject: [PATCH] fix(picker): wrap vim.fn.expand cword in pcall to avoid Vim:E348 (#2961) * fix(picker): wrap vim.fn.expand cword in pcall to avoid Vim:E348: No string under cursor * run stylua --------- Co-authored-by: James Trew --- lua/telescope/pickers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index 150d728..160b744 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -529,7 +529,7 @@ function Picker:find() self:reset_selection() self.original_win_id = a.nvim_get_current_win() - self.original_cword = vim.fn.expand "" + _, self.original_cword = pcall(vim.fn.expand, "") -- User autocmd run it before create Telescope window vim.api.nvim_exec_autocmds("User", { pattern = "TelescopeFindPre" })