feat: telescope references

This commit is contained in:
2026-06-02 13:17:31 +02:00
parent b5520b068a
commit 79fe6e83f0
+137 -120
View File
@@ -1,140 +1,157 @@
return { return {
-- fuzzy finder -- fuzzy finder
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
{ {
"nvim-telescope/telescope-live-grep-args.nvim", "nvim-telescope/telescope-live-grep-args.nvim",
-- This will not install any breaking changes. -- This will not install any breaking changes.
-- For major updates, this must be adjusted manually. -- For major updates, this must be adjusted manually.
version = "^1.0.0", version = "^1.0.0",
}, },
}, },
event = { "LspAttach" }, event = { "LspAttach" },
keys = { keys = {
{ {
"<leader>ff", "<leader>ff",
function() function()
require("telescope.builtin").find_files() require("telescope.builtin").find_files()
end, end,
desc = "Telescope find files", desc = "Telescope find files",
}, },
{ {
"<leader>flg", "<leader>fu",
function() function()
require("telescope.builtin").live_grep() require("telescope.builtin").lsp_references()
end, end,
desc = "Telescope live grep", desc = "Telescope Usage (references)",
}, },
{ {
"<leader>fg", "<leader>flg",
function() function()
require("telescope").extensions.live_grep_args.live_grep_args() require("telescope.builtin").live_grep()
end, end,
desc = "Telescope live grep args", desc = "Telescope live grep",
}, },
{ {
"<leader>fb", "<leader>fg",
function() function()
require("telescope.builtin").buffers() require("telescope").extensions.live_grep_args.live_grep_args()
end, end,
desc = "Telescope buffers", desc = "Telescope live grep args",
}, },
{ {
"<leader>fh", "<leader>fb",
function() function()
require("telescope.builtin").help_tags() require("telescope.builtin").buffers()
end, end,
desc = "Telescope nvim functions", desc = "Telescope buffers",
}, },
{ "<leader>ft", ":TodoTelescope<CR>", desc = "Telescope TODOs" }, {
"<leader>fh",
function()
require("telescope.builtin").help_tags()
end,
desc = "Telescope nvim functions",
},
-- Git { "<leader>ft", ":TodoTelescope<CR>", desc = "Telescope TODOs" },
{
"<leader>fld",
function()
require("telescope.builtin").git_status()
end,
desc = "Telescope git diff",
},
{ -- Git
"<leader>flc", {
function() "<leader>fld",
require("telescope.builtin").git_commits() function()
end, require("telescope.builtin").git_status()
desc = "Telescope git commits", end,
}, desc = "Telescope git diff",
},
{ {
"<leader>flf", "<leader>flc",
function() function()
require("telescope.builtin").git_files() require("telescope.builtin").git_commits()
end, end,
desc = "Telescope git files", desc = "Telescope git commits",
}, },
-- Recent Commands {
{ "<leader>foc", ":Telescope command_history<CR>", desc = "Telescope recent commands" }, "<leader>flf",
function()
require("telescope.builtin").git_files()
end,
desc = "Telescope git files",
},
-- Recent Searches -- Recent Commands
{ "<leader>fos", ":Telescope search_history<CR>", desc = "Telescope recent searches" }, { "<leader>foc", ":Telescope command_history<CR>", desc = "Telescope recent commands" },
-- Old Files -- Recent Searches
{ { "<leader>fos", ":Telescope search_history<CR>", desc = "Telescope recent searches" },
"<leader>fr",
function()
require("telescope.builtin").oldfiles()
end,
desc = "Telescope recent files",
},
-- Quickfix Items -- Old Files
{ "<leader>fq", ":Telescope quickfix<CR>", desc = "Telescope quickfix items" }, {
"<leader>fr",
function()
require("telescope.builtin").oldfiles()
end,
desc = "Telescope recent files",
},
-- Spell Suggestions -- Quickfix Items
{ "<leader>fs", ":Telescope spell_suggest<CR>", desc = "Telescope spellsuggestions" }, { "<leader>fq", ":Telescope quickfix<CR>", desc = "Telescope quickfix items" },
-- Diagnostics -- Spell Suggestions
{ "<leader>fd", ":Telescope diagnostics<CR>", desc = "Telescope Diagnostics" }, { "<leader>fs", ":Telescope spell_suggest<CR>", desc = "Telescope spellsuggestions" },
-- Notifications -- Diagnostics
{ "<leader>fn", ":Telescope notify<CR>", desc = "Telescope Notifications" }, { "<leader>fd", ":Telescope diagnostics<CR>", desc = "Telescope Diagnostics" },
-- Implementations -- Notifications
{ "<leader>fi", ":Telescope lsp_implementations<CR>", desc = "Telescope lsp implementations" }, { "<leader>fn", ":Telescope notify<CR>", desc = "Telescope Notifications" },
},
config = function()
local actions = require("telescope.actions")
local telescope = require("telescope")
local lga_actions = require("telescope-live-grep-args.actions")
telescope.setup({ -- Implementations
defaults = { { "<leader>fi", ":Telescope lsp_implementations<CR>", desc = "Telescope lsp implementations" },
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-q>"] = actions.smart_add_to_qflist,
["<C-A-q>"] = actions.smart_send_to_qflist,
["<C-Space>"] = lga_actions.quote_prompt(),
},
},
path_display = { "truncate" },
},
extensions = {
frecency = {
db_safe_mode = false,
matcher = "fuzzy",
},
},
})
telescope.load_extension("live_grep_args") -- References
end, {
"<leader>fu",
function()
require("telescope.builtin").lsp_references()
end,
desc = "Telescope Usage (references)",
},
},
config = function()
local actions = require("telescope.actions")
local telescope = require("telescope")
local lga_actions = require("telescope-live-grep-args.actions")
telescope.setup({
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-q>"] = actions.smart_add_to_qflist,
["<C-A-q>"] = actions.smart_send_to_qflist,
["<C-Space>"] = lga_actions.quote_prompt(),
},
},
path_display = { "truncate" },
},
extensions = {
frecency = {
db_safe_mode = false,
matcher = "fuzzy",
},
},
})
telescope.load_extension("live_grep_args")
end,
} }