aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/plugins/diagnostics.lua
blob: 78c3f020fa2e5c5dbc476625f73986f62c579991 (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
return {
    'folke/trouble.nvim',
    opts = {},
    cmd = 'Trouble',
    keys = {
        {
            "<leader>df",
            function()
                local trouble = require("trouble")
                local opts = {
                    mode = "diagnostics",
                    focus = true,
                    follow = false
                }
                if trouble.is_open(opts) then
                    trouble.close(opts)
                else
                    trouble.open(opts)
                end
            end,
            desc = "Diagnostics (Trouble)",
        },
        {
            "<leader>dF",
            function()
                local trouble = require("trouble")
                local opts = {
                    mode = "diagnostics",
                    focus = true,
                    follow = false,
                    filter = { buf = 0 }
                }
                if not trouble.is_open(opts) then
                    trouble.open(opts)
                    trouble.focus(opts)
                else
                    trouble.close(opts)
                end
            end,
            desc = "Buffer Diagnostics (Trouble)",
        },
        {
            "[d",
            function()
                require("trouble").prev({ mode = "diagnostics", jump = true })
            end,
            desc = "Previous project wide diagnostic"
        },
        {
            "]d",
            function()
                require("trouble").next({ mode = "diagnostics", jump = true })
            end,
            desc = "Next project wide diagnostic"
        },
        {
            "<leader>dl",
            "<cmd>Trouble loclist toggle<cr>",
            desc = "Location List (Trouble)",
        },
        {
            "<leader>dq",
            "<cmd>Trouble qflist toggle<cr>",
            desc = "Quickfix List (Trouble)",
        },
    },
}