summaryrefslogtreecommitdiff
path: root/neovim/.config/nvim/lua/plugins/telescope.lua
blob: 08729ca56f9e1cf7ed4dab59d37e2ae96423fc57 (plain)
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
47
48
49
50
51
52
return {
  {
    'nvim-telescope/telescope.nvim',
    tag = '0.1.8',
    dependencies = {
      {
        'nvim-lua/plenary.nvim',
      },
      {
        "nvim-telescope/telescope-live-grep-args.nvim",
        -- This will not install any breaking changes.
        -- For major updates, this must be adjusted manually.
        version = "^1.0.0",
      },
    },
    cmd = "Telescope",
    keys = {
      { '<F3>', '<cmd>Telescope buffers<CR>',    desc = 'Telescope buffers' },
      { '<F4>', '<cmd>Telescope find_files<CR>', desc = 'Telescope find files' },
      { '<F6>', '<cmd>Telescope live_grep<CR>',  desc = 'Telescope live grep' },
    },
    config = function()
      local telescope = require("telescope")
      local lga_actions = require("telescope-live-grep-args.actions")

      -- first setup telescope
      telescope.setup({
        extensions = {
          live_grep_args = {
            auto_quoting = true, -- enable/disable auto-quoting
            -- define mappings, e.g.
            mappings = {   -- extend mappings
              i = {
                ["<C-k>"] = lga_actions.quote_prompt(),
                ["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob " }),
                -- freeze the current list and start a fuzzy search in the frozen list
                ["<C-space>"] = lga_actions.to_fuzzy_refine,
              },
            },
            -- ... also accepts theme settings, for example:
            -- theme = "dropdown", -- use dropdown theme
            -- theme = { }, -- use own theme spec
            -- layout_config = { mirror=true }, -- mirror preview pane
          }
        }
      })

      -- then load the extension
      telescope.load_extension("live_grep_args")
    end
  },
}