diff options
| author | Landon Schropp <[email protected]> | 2021-12-23 02:56:19 -0600 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-23 09:56:19 +0100 | 
| commit | a3cf3b1f2a6f2fce80833753a133c9983e56d4e2 (patch) | |
| tree | 2a846e4ac903e90a3ff49e59191ec2ebf47f00ab /lua/lvim/core | |
| parent | 5e44e6d59bb8bac477c230dd8a463ddc1dd91799 (diff) | |
[Feature]: Use Telescope's git_files with fallback (#2089)
Diffstat (limited to 'lua/lvim/core')
| -rw-r--r-- | lua/lvim/core/telescope/custom-finders.lua | 10 | ||||
| -rw-r--r-- | lua/lvim/core/which-key.lua | 2 | 
2 files changed, 11 insertions, 1 deletions
| 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 diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 88af028f..a1bc3011 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -68,7 +68,7 @@ M.config = function()        ["q"] = { "<cmd>q!<CR>", "Quit" },        ["/"] = { "<cmd>lua require('Comment').toggle()<CR>", "Comment" },        ["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" }, -      ["f"] = { "<cmd>Telescope find_files<CR>", "Find File" }, +      ["f"] = { require("lvim.core.telescope.custom-finders").find_project_files, "Find File" },        ["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },        b = {          name = "Buffers", | 
