diff --git a/lua/custom/telescope.lua b/lua/custom/telescope.lua index 74b5f74..0ffbe5c 100644 --- a/lua/custom/telescope.lua +++ b/lua/custom/telescope.lua @@ -75,6 +75,17 @@ end local builtin = require("telescope.builtin") local keymap = vim.keymap +-- Live grep in quickfix list +local function live_grep_in_quick_fix_list_files() + builtin.live_grep({ + search_dirs = vim.fn.getqflist({ items = 0 }).items + and vim.tbl_map(function(item) + return vim.fn.bufname(item.bufnr) + end, vim.fn.getqflist()) + or nil + }) +end + -- Create a Neovim command vim.api.nvim_create_user_command('TelescopeGrepGlob', live_grep_with_glob, {}) @@ -89,8 +100,9 @@ keymap.set("n", "ft", "TodoTelescope", { desc = "FZF: display T keymap.set("n", "fds", builtin.lsp_document_symbols, { desc = "Grep: Document symbols" }) keymap.set('n', 'fp', live_grep_with_glob, { desc = 'Live grep with glob pattern' }) keymap.set('n', 'fcp', live_grep_in_current_dir, { desc = 'Live grep in current directory' }) -keymap.set('n', 'ccp', copy_file_path_and_position, {desc = "Copy cursor position"}) +keymap.set('n', 'ccp', copy_file_path_and_position, { desc = "Copy cursor position" }) keymap.set('n', 'ccd', copy_current_file_path, { desc = 'Live grep in current directory' }) +keymap.set('n', 'fq', live_grep_in_quick_fix_list_files, { desc = "Live grep in quickfix files" }) -- Live grep in current file vim.keymap.set('n', 'fcf', function()