local user_config = require('cosmic.core.user') return { 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/popup.nvim', 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make', }, }, config = function() require('cosmic.plugins.telescope.config') end, init = function() -- normal mappings local u = require('cosmic.utils') local map = u.map map('n', 'ff', '', { callback = require('cosmic.plugins.telescope.utils').project_files, desc = 'Find file', }) map('n', 'fp', ':Telescope find_files', { desc = 'Find project file' }) map('n', 'fk', ':Telescope buffers', { desc = 'Find buffer' }) map('n', 'fs', ':Telescope live_grep', { desc = 'Grep string' }) map('n', 'fw', ':Telescope grep_string', { desc = 'Grep current word' }) -- git navigation map('n', 'vtc', ':Telescope git_commits', { desc = 'Git commits' }) map('n', 'vts', ':Telescope git_status', { desc = 'Git status' }) user_config.lsp.add_on_attach_mapping(function(client, bufnr) local buf_map = u.create_buf_map(bufnr) buf_map('n', 'gd', 'Telescope lsp_definitions', { desc = 'Go to definition' }) buf_map('n', 'gi', 'Telescope lsp_implementations', { desc = 'Go to implementation' }) buf_map('n', 'gt', 'Telescope lsp_type_definitions', { desc = 'Go to type definition' }) buf_map('n', 'gr', 'Telescope lsp_references', { desc = 'Go to reference' }) buf_map('n', 'ldb', 'Telescope diagnostics bufnr=0', { desc = 'Show buffer diagnostics' }) buf_map('n', 'ldw', 'Telescope diagnostics', { desc = 'Workspace diagnostics' }) end) end, cmd = { 'Telescope' }, keys = { { 'ff', 'lua require("cosmic.plugins.telescope.mappings").project_files()', desc = 'Find project file', }, }, enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'telescope'), }