summaryrefslogtreecommitdiffstats
path: root/after/plugin/telescope.lua
blob: 9411e6123c1f581e180d6efbd73dccb1beafcc2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
	return
end
local actions = require('telescope.actions')
local action_layout = require("telescope.actions.layout")

telescope.setup {
  defaults = {
    borderchars = {
      prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
      results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
      preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
    },
    sorting_strategy = 'ascending',
    -- 'horizontal', 'vertical', 'bottom_pane', or 'cursor'
    layout_strategy = 'bottom_pane',
    layout_config = {
      bottom_pane = { height = 0.4, },
    },
    mappings = {
      i = {
        ["<esc>"] = actions.close,
        ['<C-h>'] = 'which_key',
        ['<C-j>'] = actions.move_selection_next,
        ['<C-k>'] = actions.move_selection_previous,
        ['<C-l>'] = actions.select_default,
        ['<C-u>'] = actions.preview_scrolling_up,
        ['<C-d>'] = actions.preview_scrolling_down,
        ["<C-p>"] = action_layout.toggle_preview
      },
      n = {
        ["gg"] = actions.move_to_top,
        ["G"] = actions.move_to_bottom,
      },
    },
  }
}
telescope.load_extension('file_browser')
telescope.load_extension('ui-select')
telescope.load_extension('projects')

a.nvim_create_autocmd('User', {
  pattern = 'TelescopePreviewerLoaded',
  command = 'setlocal number',
})