fix(telescope): check for gmake if needed

This commit is contained in:
Folke Lemaitre
2024-11-07 16:10:45 +01:00
parent a86c25286b
commit 0bc09d8206

View File

@ -4,8 +4,13 @@ if lazyvim_docs then
vim.g.lazyvim_picker = "telescope"
end
local have_make = vim.fn.executable("make") == 1
local have_cmake = vim.fn.executable("cmake") == 1
local build_cmd ---@type string?
for _, cmd in ipairs({ "make", "cmake", "gmake" }) do
if vim.fn.executable(cmd) == 1 then
build_cmd = cmd
break
end
end
---@type LazyPicker
local picker = {
@ -63,9 +68,9 @@ return {
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = have_make and "make"
build = (build_cmd ~= "cmake") and "make"
or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
enabled = have_make or have_cmake,
enabled = build_cmd ~= nil,
config = function(plugin)
LazyVim.on_load("telescope.nvim", function()
local ok, err = pcall(require("telescope").load_extension, "fzf")