From e1e143bc63895d96fa9dc86416437d11ba130e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 7 Apr 2024 14:24:58 +0200 Subject: nvim: improve telescope file open --- config/nvim/lua/mytelescopefiles.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 config/nvim/lua/mytelescopefiles.lua (limited to 'config/nvim/lua') 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 -- cgit v1.2.3