aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/plugins/telescope.lua
blob: 731c509c2b7ad5bc63f4e7e0c8c8e04b8709e314 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
return {
    'nvim-telescope/telescope.nvim', -- fuzzy finder
    dependencies = {
        'nvim-lua/plenary.nvim',
        'nvim-tree/nvim-web-devicons'
    },
    cmd = 'Telescope',
    keys = {
        {
            "<C-f>f",
            function()
                local builtin = require("telescope.builtin")
                builtin.find_files()
            end,
            desc = "Search for files (respcting .gitignore) using Telescope"
        },
        {
            "<C-f>F",
            function()
                require("telescope.builtin").find_files({ hidden = true, no_ignore_parent = true })
            end,
            desc = "Search for files (including hidden) using Telescope"
        },
        {
            "<C-f>b",
            function()
                require("telescope.builtin").buffers()
            end,
            desc = "Search for open buffers using Telescope"
        },
        { "<C-f>g", function()
            require("telescope.builtin").live_grep()
        end
        },
        {
            "<C-f>m",
            function()
                require("telescope.builtin").marks()
            end,
            desc = "Search marks using telescope"
        },
        {
            "<C-f>q",
            function()
                local themes = require("telescope.themes")
                require("telescope.builtin").quickfix(themes.get_ivy({}))
            end,
            desc = "Search in the the quickfix buffer using Telescope"
        },
        {
            "<C-f>l",
            function()
                local themes = require("telescope.themes")
                require("telescope.builtin").loclist(themes.get_ivy({}))
            end,
            desc = "Search within a location list using Telescope"
        },
        {
            "<C-f>d",
            function()
                local themes = require("telescope.themes")
                require("telescope.builtin").diagnostics(themes.get_ivy({}))
            end,
            desc = "Search through diagnostics using Telescope"
        },
        {
            "<C-f>r",
            function()
                -- TODO: if lsp supports reference provider and lsp is attached
                -- [telescope.builtin.lsp_*]: server does not support referencesProvider
                local themes = require("telescope.themes")
                if #vim.lsp.get_clients({ bufnr = 0 }) > 0 then
                    require("telescope.builtin").lsp_references(themes.get_ivy({}))
                else
                    require("telescope.builtin").grep_string(themes.get_ivy({}))
                end
            end,
            desc = "Search for refences via grep or a language server using Telescope"
        }
    }
}