160 lines
5.6 KiB
Lua
160 lines
5.6 KiB
Lua
local telescope = require('telescope')
|
|
local actions = require('telescope.actions')
|
|
local icons = require('lib.icons')
|
|
local flash = require('plugins.tools.telescope-custom').flash
|
|
local multi_open = require('plugins.tools.telescope-custom').multi_open
|
|
|
|
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 = {
|
|
['<esc>'] = actions.close,
|
|
['<C-n>'] = actions.cycle_history_next,
|
|
['<C-p>'] = actions.cycle_history_prev,
|
|
|
|
['<C-j>'] = actions.move_selection_next,
|
|
['<C-k>'] = actions.move_selection_previous,
|
|
|
|
['<C-c>'] = actions.close,
|
|
|
|
['<Down>'] = actions.move_selection_next,
|
|
['<Up>'] = actions.move_selection_previous,
|
|
|
|
['<CR>'] = multi_open,
|
|
['<C-x>'] = actions.select_horizontal,
|
|
['<C-CR>'] = actions.select_vertical,
|
|
['<S-CR>'] = actions.select_horizontal,
|
|
['<C-v>'] = actions.select_vertical,
|
|
['<C-t>'] = actions.select_tab,
|
|
['<C-s>'] = flash,
|
|
|
|
['<C-u>'] = actions.preview_scrolling_up,
|
|
['<C-d>'] = actions.preview_scrolling_down,
|
|
|
|
['<PageUp>'] = actions.results_scrolling_up,
|
|
['<PageDown>'] = actions.results_scrolling_down,
|
|
|
|
['<Tab>'] = actions.toggle_selection + actions.move_selection_worse,
|
|
['<S-Tab>'] = actions.toggle_selection + actions.move_selection_better,
|
|
['<C-q>'] = actions.send_to_qflist + actions.open_qflist,
|
|
['<M-q>'] = actions.send_selected_to_qflist + actions.open_qflist,
|
|
['<C-l>'] = actions.complete_tag,
|
|
},
|
|
|
|
n = {
|
|
['q'] = actions.close,
|
|
['<esc>'] = actions.close,
|
|
['<CR>'] = multi_open,
|
|
['<C-x>'] = actions.select_horizontal,
|
|
['<C-v>'] = actions.select_vertical,
|
|
['<C-t>'] = actions.select_tab,
|
|
['s'] = flash,
|
|
|
|
['<Tab>'] = actions.toggle_selection + actions.move_selection_worse,
|
|
['<S-Tab>'] = actions.toggle_selection + actions.move_selection_better,
|
|
['<C-q>'] = actions.send_to_qflist + actions.open_qflist,
|
|
['<M-q>'] = 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,
|
|
|
|
['<Down>'] = actions.move_selection_next,
|
|
['<Up>'] = actions.move_selection_previous,
|
|
['gg'] = actions.move_to_top,
|
|
['G'] = actions.move_to_bottom,
|
|
|
|
['<C-u>'] = actions.preview_scrolling_up,
|
|
['<C-d>'] = actions.preview_scrolling_down,
|
|
|
|
['<PageUp>'] = actions.results_scrolling_up,
|
|
['<PageDown>'] = actions.results_scrolling_down,
|
|
|
|
['?'] = actions.which_key,
|
|
},
|
|
},
|
|
},
|
|
extensions = {
|
|
fzf = {
|
|
fuzzy = true,
|
|
override_generic_sorter = true,
|
|
override_file_sorter = true,
|
|
case_mode = 'smart_case',
|
|
},
|
|
file_browser = {
|
|
theme = 'ivy',
|
|
hijack_netrw = true,
|
|
mappings = {
|
|
['i'] = {
|
|
-- your custom insert mode mappings
|
|
},
|
|
['n'] = {
|
|
-- your custom normal mode mappings
|
|
},
|
|
},
|
|
},
|
|
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 = {
|
|
['<S-cr>'] = require('telescope-undo.actions').yank_additions,
|
|
['<C-cr>'] = require('telescope-undo.actions').yank_deletions,
|
|
['<cr>'] = require('telescope-undo.actions').restore,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
telescope.load_extension('fzf')
|
|
telescope.load_extension('undo')
|
|
telescope.load_extension('marks_nvim')
|
|
telescope.load_extension('refactoring')
|
|
telescope.load_extension('file_browser')
|