commit a646da76f07fee05adebfa7caa9618013ed2145e
parent 80a47f1888201f8695940e6f8424e92c3bd2f2d8
Author: mdnrz <mehdeenoroozi@gmail.com>
Date: Sun, 14 Sep 2025 13:03:47 +0330
nvim: add telescope keymap for outside directory
Diffstat:
1 file changed, 31 insertions(+), 0 deletions(-)
diff --git a/nvim/.config/nvim/lua/config/plugins/telescope.lua b/nvim/.config/nvim/lua/config/plugins/telescope.lua
@@ -1,4 +1,18 @@
local builtin = require("telescope.builtin")
+local outside_dir_path = nil
+
+function get_outside_dir()
+ if not outside_dir_path then
+ local input = vim.fn.input("Gimme the path: ", vim.fn.getcwd(), "dir")
+ if input ~= "" then
+ outside_dir_path = vim.fn.fnamemodify(input, ":p") -- nomalize to absolute path
+ else
+ vim.notify("Empty path; Aborting.", vim.log.levels.WARN)
+ return
+ end
+ end
+end
+
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
-- or , branch = '0.1.x',
@@ -32,6 +46,23 @@ return {
builtin.find_files({no_ignore = true, hidden = true })
end,
},
+ {
+ "<leader>fo",
+ function()
+ get_outside_dir()
+ builtin.find_files({cwd = outside_dir_path})
+ end,
+ desc = "Find files in outside directory.",
+ },
+
+ {
+ "<leader>go",
+ function()
+ get_outside_dir()
+ builtin.live_grep({cwd = outside_dir_path})
+ end,
+ desc = "Find files in outside directory.",
+ },
},
}