aboutsummaryrefslogtreecommitdiff
path: root/config/nvim/lua/mytelescopefiles.lua
blob: 46253eb93a253fa1597c04abe6d53cf9b6cf4adb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local ts = require("telescope.builtin")
local utils = require("telescope.utils")

return function()
	local root, ret = utils.get_os_command_output({ "git", "rev-parse", "--show-toplevel" }, vim.fn.expand("%:h"))
	if ret == 0 then
		ts.git_files({
			git_command = {
				"sh",
				"-c",
				"git -C "
					.. root[1]
					.. " ls-files -c --recurse-submodules && git -C "
					.. root[1]
					.. " ls-files -o --exclude-standard",
			},
		})
	else
		-- TODO use root if this file is relative to the current one
		ts.find_files()
	end
end