summaryrefslogtreecommitdiffstats
path: root/lua/utilities/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/utilities/util.lua')
-rw-r--r--lua/utilities/util.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/lua/utilities/util.lua b/lua/utilities/util.lua
new file mode 100644
index 0000000..ec6c400
--- /dev/null
+++ b/lua/utilities/util.lua
@@ -0,0 +1,19 @@
+local M = {}
+
+function M.telescope(builtin, opts)
+ local params = { builtin = builtin, opts = opts }
+ return function()
+ builtin = params.builtin
+ opts = params.opts
+ opts = vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {})
+ if builtin == "files" then
+ if vim.loop.fs_stat((opts.cwd or vim.loop.cwd()) .. "/.git") then
+ opts.show_untracked = true
+ builtin = "git_files"
+ else
+ builtin = "find_files"
+ end
+ end
+ require("telescope.builtin")[builtin](opts)
+ end
+end