From 3277805e69f50bf3eaf981b3fc7610f52d26538a Mon Sep 17 00:00:00 2001 From: David Ibia Date: Sun, 14 Jan 2024 03:12:36 +0100 Subject: [PATCH] chore(telescope.lua): refactor key mappings and add support for trouble.nvim integration The key mappings in the telescope.lua file have been refactored to use the new mappings syntax introduced in the latest version of Telescope. Additionally, support for the trouble.nvim plugin has been added by mapping the `` key to the `trouble.open_with_trouble` function in both insert and normal mode. This allows for easier navigation and troubleshooting within Telescope. --- lua/absolute/after/telescope.lua | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lua/absolute/after/telescope.lua b/lua/absolute/after/telescope.lua index 923de28..39a5ecd 100644 --- a/lua/absolute/after/telescope.lua +++ b/lua/absolute/after/telescope.lua @@ -1,11 +1,23 @@ local telescope = require("telescope") -local builtin = require('telescope.builtin') +local builtin = require("telescope.builtin") +local trouble = require("trouble.providers.telescope") -telescope.setup {} +telescope.setup({ + defaults = { + mappings = { + i = { + [""] = trouble.open_with_trouble, + }, + n = { + [""] = trouble.open_with_trouble, + }, + }, + }, +}) -vim.keymap.set("n", 'pf', builtin.find_files, { desc = "Fuzzy find files in cwd" }) -vim.keymap.set("n", 'pr', builtin.oldfiles, { desc = "Fuzzy find recent files" }) -vim.keymap.set("n", '', builtin.git_files, { desc = "Fuzzy find files in git in cwd" }) -vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }); +vim.keymap.set("n", "pf", builtin.find_files, { desc = "Fuzzy find files in cwd" }) +vim.keymap.set("n", "pr", builtin.oldfiles, { desc = "Fuzzy find recent files" }) +vim.keymap.set("n", "", builtin.git_files, { desc = "Fuzzy find files in git in cwd" }) +vim.keymap.set("n", "ps", function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) end, { desc = "Find string under cursor in cwd" })