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.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/config/nvim/lua/mytelescopefiles.lua b/config/nvim/lua/mytelescopefiles.lua
index 733a1d8..2a98505 100644
--- a/config/nvim/lua/mytelescopefiles.lua
+++ b/config/nvim/lua/mytelescopefiles.lua
@@ -2,10 +2,15 @@ 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"))
+ local dir = vim.fn.expand("%:h")
+ if dir == "" or not vim.fn.exists(dir) then
+ dir = vim.fn.getcwd()
+ end
+ local root, ret = utils.get_os_command_output({ "git", "rev-parse", "--show-toplevel" }, dir)
+ root = root[1]
if ret == 0 then
ts.git_files({
- cwd = root[1],
+ cwd = root,
git_command = {
"sh",
"-c",