Add function to live grep in files from quickfix list
This commit is contained in:
parent
7e149df236
commit
a4ea5c0f48
1 changed files with 13 additions and 1 deletions
|
|
@ -75,6 +75,17 @@ end
|
||||||
local builtin = require("telescope.builtin")
|
local builtin = require("telescope.builtin")
|
||||||
local keymap = vim.keymap
|
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
|
-- Create a Neovim command
|
||||||
vim.api.nvim_create_user_command('TelescopeGrepGlob', live_grep_with_glob, {})
|
vim.api.nvim_create_user_command('TelescopeGrepGlob', live_grep_with_glob, {})
|
||||||
|
|
||||||
|
|
@ -89,8 +100,9 @@ keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "FZF: display T
|
||||||
keymap.set("n", "<leader>fds", builtin.lsp_document_symbols, { desc = "Grep: Document symbols" })
|
keymap.set("n", "<leader>fds", builtin.lsp_document_symbols, { desc = "Grep: Document symbols" })
|
||||||
keymap.set('n', '<leader>fp', live_grep_with_glob, { desc = 'Live grep with glob pattern' })
|
keymap.set('n', '<leader>fp', live_grep_with_glob, { desc = 'Live grep with glob pattern' })
|
||||||
keymap.set('n', '<leader>fcp', live_grep_in_current_dir, { desc = 'Live grep in current directory' })
|
keymap.set('n', '<leader>fcp', live_grep_in_current_dir, { desc = 'Live grep in current directory' })
|
||||||
keymap.set('n', '<leader>ccp', copy_file_path_and_position, {desc = "Copy cursor position"})
|
keymap.set('n', '<leader>ccp', copy_file_path_and_position, { desc = "Copy cursor position" })
|
||||||
keymap.set('n', '<leader>ccd', copy_current_file_path, { desc = 'Live grep in current directory' })
|
keymap.set('n', '<leader>ccd', copy_current_file_path, { desc = 'Live grep in current directory' })
|
||||||
|
keymap.set('n', '<leader>fq', live_grep_in_quick_fix_list_files, { desc = "Live grep in quickfix files" })
|
||||||
|
|
||||||
-- Live grep in current file
|
-- Live grep in current file
|
||||||
vim.keymap.set('n', '<leader>fcf', function()
|
vim.keymap.set('n', '<leader>fcf', function()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue