summaryrefslogtreecommitdiff
path: root/ar
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-09-03 14:14:44 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-09-03 14:14:44 +0900
commite07cd6c5d9b0fae56c31577631acf7538e45a60f (patch)
treeb090c77f8dbe788787097b20757ab842f23e2902 /ar
parenta77398a63c3e46060e31304499f4a19bd6d46767 (diff)
updates
Diffstat (limited to 'ar')
-rw-r--r--ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua49
1 files changed, 47 insertions, 2 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua
index 9460187..98fd30a 100644
--- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua
+++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua
@@ -517,6 +517,42 @@ return {
local open_with_trouble = require("trouble.sources.telescope").open
local add_to_trouble = require("trouble.sources.telescope").add
+ local function telescope_open_single_or_multi(prompt_bufnr)
+ local picker = actions_state.get_current_picker(prompt_bufnr)
+ local multi = picker:get_multi_selection()
+
+ -- If you selected multiple (with <Tab>), open them all.
+ if not vim.tbl_isempty(multi) then
+ actions.close(prompt_bufnr)
+
+ for _, entry in ipairs(multi) do
+ -- Try to get a filepath across different pickers
+ local path = entry.path -- find_files, oldfiles, etc.
+ or entry.filename -- live_grep/grep_string
+ or (type(entry.value) == "string" and entry.value)
+ or (entry.value and entry.value.path)
+
+ if path then
+ vim.cmd("edit " .. vim.fn.fnameescape(path))
+
+ -- (Optional) jump to the matched line/col for grep results
+ local lnum = entry.lnum or entry.row
+ local col = entry.col
+ if lnum then
+ vim.api.nvim_win_set_cursor(0, { lnum, math.max((col or 1) - 1, 0) })
+ end
+ elseif entry.bufnr then
+ -- buffers picker
+ vim.cmd("buffer " .. entry.bufnr)
+ end
+ end
+ return
+ end
+
+ -- Single selection → let Telescope handle it
+ -- This respects picker-specific behavior (e.g. jumping to lnum for grep).
+ actions.select_default(prompt_bufnr)
+ end
require("telescope").setup({
defaults = {
mappings = {
@@ -549,6 +585,7 @@ return {
["<C-o><C-l>"] = actions.insert_original_cline,
["<M-f>"] = actions.nop,
["<M-k>"] = actions.nop,
+ ["<CR>"] = telescope_open_single_or_multi,
},
n = {
["q"] = actions.close,
@@ -635,6 +672,14 @@ return {
"--follow",
"--hidden",
"--sortr=modified",
+ "--glob",
+ "!**/.cache/*/*/*",
+ "--glob",
+ "!**/.git/*/*/*",
+ "--glob",
+ "!**/.next/*/*/*",
+ "--glob",
+ "!**/node_modules/*/*/*",
},
},
},
@@ -645,14 +690,14 @@ return {
require("telescope.builtin").buffers({
sort_mru = true,
sort_lastused = true,
- initial_mode = "normal",
+ -- initial_mode = "normal",
})
end, { desc = "Find buffer files" })
vim.keymap.set("n", "<leader>fb", function()
require("telescope.builtin").buffers({
sort_mru = true,
sort_lastused = true,
- initial_mode = "normal",
+ -- initial_mode = "normal",
})
end, { desc = "Find buffer files" })
vim.keymap.set("n", "<leader>fc", function()