Skip to content

Commit

Permalink
fix(picker): wrap vim.fn.expand cword in pcall to avoid Vim:E348 (#2961)
Browse files Browse the repository at this point in the history
* fix(picker): wrap vim.fn.expand cword in pcall to avoid Vim:E348: No string under cursor

* run stylua

---------

Co-authored-by: James Trew <[email protected]>
  • Loading branch information
metaory and jamestrew authored Feb 29, 2024
1 parent d5c4d98 commit 5f5fc3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/telescope/pickers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" })
Expand Down

0 comments on commit 5f5fc3a

Please sign in to comment.