aboutsummaryrefslogtreecommitdiff
path: root/config/nvim/lua/mytelescopefiles.lua
diff options
context:
space:
mode:
Diffstat (limited to 'config/nvim/lua/mytelescopefiles.lua')
-rw-r--r--config/nvim/lua/mytelescopefiles.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/config/nvim/lua/mytelescopefiles.lua b/config/nvim/lua/mytelescopefiles.lua
new file mode 100644
index 0000000..46253eb
--- /dev/null
+++ b/config/nvim/lua/mytelescopefiles.lua
@@ -0,0 +1,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