local telescope = {} telescope.opts = {} -- default dependencies telescope.dependencies = { ---@string[] 'nvim-treesitter', 'nvim-web-devicons', 'plenary.nvim', 'popup.nvim', 'project.nvim', } -- This must exist even if we keep it empty for later configuration to work telescope.opts.opts = { defaults = { prompt_prefix = "🔎 ", layout_config = { height = 0.90, prompt_position = "top", }, sorting_strategy = "ascending", dynamic_preview_title = true, }, pickers = {}, extensions = { file_browser = { grouped = true, hijack_netrw = true, dir_icon = "📁", hidden = true, }, }, } -- TESTS for telescope-media-files if vim.fn.executable('chafa') then -- if chafa is installed then we set a flag and add the dependency to telescope telescope.opts.has_chafa = true table.insert(telescope.dependencies, 'nvim-telescope/telescope-media-files.nvim') telescope.opts.opts.extensions.media_files = { filetypes = { 'png', 'jpg', 'jpeg', 'webp', 'svg' }, } end -- TESTS for telescope-fzf-native -- If not windows then attempt to build and use it. -- We also check a global flag here that we can set if we can't build fzf-native if vim.fn.has('win32') == 0 and not vim.g.no_fzf then -- NOTE: has returns 0 when we don't have a feature telescope.opts.do_fzf = true table.insert(telescope.dependencies, 'telescope-fzf-native.nvim') end -- TESTS for fzf-native telescope.config = function(_, opts) require('telescope').setup(opts.opts) if opts.has_chafa then require('telescope').load_extension('media_files') end if opts.do_fzf then require('telescope').load_extension('fzf') end require('telescope').load_extension('projects') end return { { 'nvim-telescope/telescope.nvim', cmd = 'Telescope', opts = telescope.opts, config = telescope.config, keys = telescope.keys, dependencies = telescope.dependencies, }, { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make', cond = function() return vim.fn.has('win32') == 0 and not vim.g.no_fzf end, }, { 'ahmedkhalf/project.nvim', opts = { detection_methods = { 'pattern' }, }, config = true, main = 'project_nvim', }, }