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 <j.trew10@gmail.com>
This commit is contained in:
Pou Yan
2024-02-29 19:59:47 +08:00
committed by GitHub
parent d5c4d98563
commit 5f5fc3aa75

View File

@@ -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 "<cword>"
_, self.original_cword = pcall(vim.fn.expand, "<cword>")
-- User autocmd run it before create Telescope window
vim.api.nvim_exec_autocmds("User", { pattern = "TelescopeFindPre" })