From 1f38692ec87635c53b254fb36a397f245a90749c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Tue, 10 Oct 2023 10:50:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(nvim):=20install=20fzf=20for?= =?UTF-8?q?=20telescope=20by=20default=20if=20make=20is=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/nvim/lua/plugins/telescope.lua | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 5e596df5..8c5db333 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -7,11 +7,16 @@ return { cmd = "Telescope", version = false, -- telescope did only one release, so use HEAD for now dependencies = { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - config = function() - require("telescope").load_extension("fzf") - end, + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + enabled = vim.fn.executable("make") == 1, + config = function() + Util.on_load("telescope.nvim", function() + require("telescope").load_extension("fzf") + end) + end, + }, }, keys = { { @@ -407,6 +412,19 @@ return { defaults = { prompt_prefix = " ", selection_caret = " ", + -- open files in the first window that is an actual file. + -- use the current window if no other window is available. + get_selection_window = function() + local wins = vim.api.nvim_list_wins() + table.insert(wins, 1, vim.api.nvim_get_current_win()) + for _, win in ipairs(wins) do + local buf = vim.api.nvim_win_get_buf(win) + if vim.bo[buf].buftype == "" then + return win + end + end + return 0 + end, mappings = { i = { [""] = open_with_trouble,