From a7c79cb5a04562be10347856642a80f0c4be89fc Mon Sep 17 00:00:00 2001 From: delta Date: Fri, 17 Apr 2026 08:10:30 +0200 Subject: sync --- .config/nvim/lua/plugins/telescope.lua | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .config/nvim/lua/plugins/telescope.lua (limited to '.config/nvim/lua/plugins/telescope.lua') diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..7633996 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,65 @@ +local state = require "state" + +return { + "nvim-telescope/telescope.nvim", + opts = function(_, opts) + local actions = require "telescope.actions" + local actions_mt = require "telescope.actions.mt" + + local open_quickfix = actions_mt.transform("open_quickfix", actions_mt.create(), nil, { + action = function() + require("trouble").open "qflist" + end, + }) + + return vim.tbl_deep_extend("force", opts, { + defaults = { + mappings = { + n = { + [""] = actions.send_to_qflist + open_quickfix, + [""] = "preview_scrolling_left", + [""] = "preview_scrolling_up", + [""] = "preview_scrolling_down", + [""] = "preview_scrolling_right", + }, + i = { + [""] = actions.send_to_qflist + open_quickfix, + [""] = "preview_scrolling_left", + [""] = "preview_scrolling_up", + [""] = "preview_scrolling_down", + [""] = "preview_scrolling_right", + }, + }, + }, + }) + end, + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = function() + local builtin = require "telescope.builtin" + return { + { "ff", builtin.find_files, desc = "Telescope: find files" }, + { + "fF", + function() + builtin.find_files(state.nvim_tree_root and { + cwd = state.nvim_tree_root, + }) + end, + desc = "Telescope: find files in nvim-tree root", + }, + { "fg", builtin.live_grep, desc = "Telescope: live grep" }, + { + "fG", + function() + builtin.live_grep(state.nvim_tree_root and { + cwd = state.nvim_tree_root, + }) + end, + desc = "Telescope: live grep in nvim-tree root", + }, + } + end, + cmd = { "Telescope" }, +} -- cgit v1.2.3