mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-13 10:54:40 +02:00
fix(fzf-native): try rebuilding fzf-native when needed. Fixes #2464
This commit is contained in:
parent
abb1ff0d60
commit
39901c1f00
1 changed files with 18 additions and 4 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
local have_make = vim.fn.executable("make") == 1
|
||||||
|
local have_cmake = vim.fn.executable("cmake") == 1
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
-- file explorer
|
-- file explorer
|
||||||
|
@ -141,12 +144,23 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"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",
|
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,
|
enabled = have_make or have_cmake,
|
||||||
config = function()
|
config = function(plugin)
|
||||||
LazyVim.on_load("telescope.nvim", function()
|
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)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue