aboutsummaryrefslogtreecommitdiff
path: root/config/nvim/lua
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2024-04-07 14:24:58 +0200
committerKarel Kočí <cynerd@email.cz>2024-04-07 14:24:58 +0200
commite1e143bc63895d96fa9dc86416437d11ba130e16 (patch)
tree03345eae1a469d1692d33c16b23bd72d9e48304f /config/nvim/lua
parent7e0877988e4f1104d4f13f1b157ace744302fcc9 (diff)
downloadmyconfigs-e1e143bc63895d96fa9dc86416437d11ba130e16.tar.gz
myconfigs-e1e143bc63895d96fa9dc86416437d11ba130e16.tar.bz2
myconfigs-e1e143bc63895d96fa9dc86416437d11ba130e16.zip
nvim: improve telescope file open
Diffstat (limited to 'config/nvim/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