diff options
| author | delta <darkussdelta@gmail.com> | 2026-04-17 08:10:30 +0200 |
|---|---|---|
| committer | delta <darkussdelta@gmail.com> | 2026-04-17 08:10:30 +0200 |
| commit | a7c79cb5a04562be10347856642a80f0c4be89fc (patch) | |
| tree | 98fac95855d84f5037a1c6f44061cbe94b550600 /.config/nvim/lua/plugins/telescope.lua | |
| parent | 225eeafcea67d63a608f9c666faf2a2ef014be4a (diff) | |
Diffstat (limited to '.config/nvim/lua/plugins/telescope.lua')
| -rw-r--r-- | .config/nvim/lua/plugins/telescope.lua | 65 |
1 files changed, 65 insertions, 0 deletions
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 = { + ["<C-q>"] = actions.send_to_qflist + open_quickfix, + ["<C-h>"] = "preview_scrolling_left", + ["<C-k>"] = "preview_scrolling_up", + ["<C-j>"] = "preview_scrolling_down", + ["<C-l>"] = "preview_scrolling_right", + }, + i = { + ["<C-q>"] = actions.send_to_qflist + open_quickfix, + ["<C-h>"] = "preview_scrolling_left", + ["<C-k>"] = "preview_scrolling_up", + ["<C-j>"] = "preview_scrolling_down", + ["<C-l>"] = "preview_scrolling_right", + }, + }, + }, + }) + end, + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = function() + local builtin = require "telescope.builtin" + return { + { "<Leader>ff", builtin.find_files, desc = "Telescope: find files" }, + { + "<Leader>fF", + function() + builtin.find_files(state.nvim_tree_root and { + cwd = state.nvim_tree_root, + }) + end, + desc = "Telescope: find files in nvim-tree root", + }, + { "<Leader>fg", builtin.live_grep, desc = "Telescope: live grep" }, + { + "<Leader>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" }, +} |
