Skip to content

Commit

Permalink
fix(fzf-native): try rebuilding fzf-native when needed. Fixes #2464
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 13, 2024
1 parent abb1ff0 commit 39901c1
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions lua/lazyvim/plugins/editor.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
local have_make = vim.fn.executable("make") == 1
local have_cmake = vim.fn.executable("cmake") == 1

return {

-- file explorer
Expand Down Expand Up @@ -141,12 +144,23 @@ return {
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = vim.fn.executable("make") == 1 and "make"
build = have_make and "make"
or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
enabled = vim.fn.executable("make") == 1 or vim.fn.executable("cmake") == 1,
config = function()
enabled = have_make or have_cmake,
config = function(plugin)
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("fzf")
local ok, err = pcall(require("telescope").load_extension, "fzf")
if not ok then
local lib = plugin.dir .. "/build/libfzf." .. (LazyVim.is_win() and "dll" or "so")
if not vim.uv.fs_stat(lib) then
LazyVim.warn("`telescope-fzf-native.nvim` not built. Rebuilding...")
require("lazy").build({ plugins = { plugin }, show = false }):wait(function()
LazyVim.info("Rebuilding `telescope-fzf-native.nvim` done.\nPlease restart Neovim.")
end)
else
LazyVim.error("Failed to load `telescope-fzf-native.nvim`:\n" .. err)
end
end
end)
end,
},
Expand Down

0 comments on commit 39901c1

Please sign in to comment.