local M = { 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, lazy = true, cmd = 'Telescope', } function M.config() local actions = require 'telescope.actions' require 'telescope'.setup { defaults = { path_display = { 'filename_first' }, layout_strategy = 'horizontal', layout_config = { prompt_position = 'top', width = function(_, max_columns, _) return math.min(max_columns, 180) end, horizontal = { preview_width = 0.5, }, }, sorting_strategy = 'ascending', scroll_strategy = 'limit', mappings = { i = {}, n = { [''] = actions.close, ['q'] = actions.close, }, }, }, pickers = { find_files = { hidden = true, }, live_grep = { disable_coordinates = true, }, grep_string = { disable_coordinates = true, }, }, extensions = { file_browser = { git_icons = { added = "A", changed = "M", copied = "C", deleted = "D", renamed = "R", unmerged = "U", untracked = "?", }, }, }, } end M.keymap = function() local builtin = require 'telescope.builtin' vim.keymap.set('n', 'f', builtin.find_files) vim.keymap.set('n', 'r', builtin.resume) vim.keymap.set('n', '', function() builtin.grep_string { word_match = '-w' } end) vim.keymap.set('v', '', builtin.grep_string) vim.keymap.set('n', 'st', builtin.live_grep) vim.keymap.set('n', 'o', builtin.lsp_document_symbols) vim.keymap.set('n', 'p', builtin.lsp_workspace_symbols) vim.keymap.set('n', 'gb', builtin.git_branches) vim.keymap.set('n', 'gc', builtin.git_commits) vim.keymap.set('n', '', builtin.git_status) end return M