From a3cf3b1f2a6f2fce80833753a133c9983e56d4e2 Mon Sep 17 00:00:00 2001 From: Landon Schropp Date: Thu, 23 Dec 2021 02:56:19 -0600 Subject: [Feature]: Use Telescope's git_files with fallback (#2089) --- lua/lvim/core/telescope/custom-finders.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lua/lvim/core/telescope') diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua index 5ce1485c..18307fbd 100644 --- a/lua/lvim/core/telescope/custom-finders.lua +++ b/lua/lvim/core/telescope/custom-finders.lua @@ -82,4 +82,14 @@ function M.view_lunarvim_changelog() }):find() end +-- Smartly opens either git_files or find_files, depending on whether the working directory is +-- contained in a Git repo. +function M.find_project_files() + local ok = pcall(builtin.git_files) + + if not ok then + builtin.find_files() + end +end + return M -- cgit v1.2.3