Open ChocolateOverflow opened 1 year ago
That would be great, hope they add an option
I tried tweaking the find_project_files
function from the lua/telescope/_extensions/project.lua
file like this:
local utils = require("telescope.utils")
...
local function find_project_files(prompt_bufnr)
local project_path, cd_successful = change_working_directory(prompt_bufnr, true)
local opt = {
cwd = project_path,
hidden = config.options.show_hidden,
mode = "insert",
}
local _, ret, _ = utils.get_os_command_output({ "git", "rev-parse", "--is-inside-work-tree" })
if cd_successful then
if ret == 0 then
builtin.git_files(opt)
else
builtin.find_files(opt)
end
end
end
It checks if the current directory is a git repo; if yes, it will use Telescope's git_files
to search files, which might solve your problem. Hope this helps!
Update: I have a fork for it, you can check it out on my profile.
@lonhattan007 Good tweak to allow use of git_files. I would move execution of the git command inside if cd_successful
since there is no point in running the command if the cd failed.
@KnBrckr Thank you for pointing that out. I updated the code as you said.
I have my own dotfiles repo with a lot of
.files
and.dirs
(obviously) and I wantproject.nvim
to include & show those, but I generally don't want to see the.git
directory in any project. I'd like a way to show my dotfiles but not.git
and the like.