local telescope = require('telescope') local actions = require('telescope.actions') local icons = require('lib.icons') local function flash(prompt_bufnr) require('flash').jump({ pattern = '^', label = { after = { 0, 0 } }, search = { mode = 'search', exclude = { function(win) return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= 'TelescopeResults' end, }, }, action = function(match) local picker = require('telescope.actions.state').get_current_picker(prompt_bufnr) picker:set_selection(match.pos[1] - 1) end, }) end telescope.setup({ defaults = { layout_config = { height = 0.8, width = 0.9, prompt_position = 'top', bottom_pane = { height = 0.5, preview_width = 0.6, preview_cutoff = 120, }, center = { height = 0.4, preview_cutoff = 40, }, cursor = { preview_cutoff = 40, preview_width = 0.6, }, horizontal = { preview_width = 0.6, preview_cutoff = 120, }, vertical = { preview_cutoff = 40, }, }, prompt_prefix = icons.ui.Telescope .. icons.ui.ChevronRight, selection_caret = icons.ui.Play, multi_icon = icons.ui.Check, path_display = { 'smart' }, -- path_display = { filename_first = { reverse_directories = false } }, sorting_strategy = 'ascending', mappings = { i = { [''] = actions.close, [''] = actions.cycle_history_next, [''] = actions.cycle_history_prev, [''] = actions.move_selection_next, [''] = actions.move_selection_previous, [''] = actions.close, [''] = actions.move_selection_next, [''] = actions.move_selection_previous, [''] = actions.select_default, [''] = actions.select_horizontal, [''] = actions.select_vertical, [''] = actions.select_horizontal, [''] = actions.select_vertical, [''] = actions.select_tab, [''] = flash, [''] = actions.preview_scrolling_up, [''] = actions.preview_scrolling_down, [''] = actions.results_scrolling_up, [''] = actions.results_scrolling_down, [''] = actions.toggle_selection + actions.move_selection_worse, [''] = actions.toggle_selection + actions.move_selection_better, [''] = actions.send_to_qflist + actions.open_qflist, [''] = actions.send_selected_to_qflist + actions.open_qflist, [''] = actions.complete_tag, }, n = { ['q'] = actions.close, [''] = actions.close, [''] = actions.select_default, [''] = actions.select_horizontal, [''] = actions.select_vertical, [''] = actions.select_tab, ['s'] = flash, [''] = actions.toggle_selection + actions.move_selection_worse, [''] = actions.toggle_selection + actions.move_selection_better, [''] = actions.send_to_qflist + actions.open_qflist, [''] = actions.send_selected_to_qflist + actions.open_qflist, ['j'] = actions.move_selection_next, ['k'] = actions.move_selection_previous, ['H'] = actions.move_to_top, ['M'] = actions.move_to_middle, ['L'] = actions.move_to_bottom, [''] = actions.move_selection_next, [''] = actions.move_selection_previous, ['gg'] = actions.move_to_top, ['G'] = actions.move_to_bottom, [''] = actions.preview_scrolling_up, [''] = actions.preview_scrolling_down, [''] = actions.results_scrolling_up, [''] = actions.results_scrolling_down, ['?'] = actions.which_key, }, }, }, extensions = { fzf = { fuzzy = true, override_generic_sorter = true, override_file_sorter = true, case_mode = 'smart_case', }, undo = { use_delta = true, use_custom_command = nil, side_by_side = true, vim_diff_opts = { ctxlen = vim.o.scrolloff * 2, }, entry_format = 'state #$ID, $STAT, $TIME', -- time_format = '%d %b %H:%M', saved_only = false, layout_strategy = 'vertical', layout_config = { preview_height = 0.7, }, mappings = { i = { [''] = require('telescope-undo.actions').yank_additions, [''] = require('telescope-undo.actions').yank_deletions, [''] = require('telescope-undo.actions').restore, }, }, }, menufacture = { mappings = { main_menu = { [{ 'i', 'n' }] = '' } } }, }, }) require('telescope').load_extension('fzf') require('telescope').load_extension('menufacture') require('telescope').load_extension('undo') telescope.load_extension('marks_nvim') require('telescope').load_extension('harpoon') require('telescope').load_extension('notify') require('telescope').load_extension('noice') require('telescope').load_extension('refactoring') require('telescope').load_extension('file_browser') require('telescope').load_extension('flutter')