summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/todo-comments.lua
blob: 8ee1a658c7d5547716f9b039c388c6a636cb40a7 (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
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
82
83
84
85
86
87
88
89
90
91
92
return {
    'folke/todo-comments.nvim',
    dependencies = { 'nvim-lua/plenary.nvim' },
    event = 'VeryLazy',
    keys = {
        -- {
        --     '<leader>st',
        --     function()
        --         Snacks.picker.todo_comments({
        --             layout = 'telescope',
        --             follow = true,
        --             hidden = true,
        --             keywords = { 'TODO', 'WIP', 'FIX', 'FIXME', 'OPTIMIZE', 'SECURE' },
        --         })
        --     end,
        --     desc = '[S]earch [T]odos',
        -- },
        -- {
        --     '<leader>sn',
        --     function()
        --         Snacks.picker.todo_comments({
        --             layout = 'telescope',
        --             follow = true,
        --             hidden = true,
        --             keywords = {
        --                 'NOTE',
        --                 'INFO',
        --                 'DOCS',
        --                 'TEST',
        --                 'WARN',
        --                 'WARNING',
        --                 'SECURITY',
        --                 'HACK',
        --                 'IMPORTANT',
        --                 'PERF',
        --                 'STUDY',
        --                 'UNSAFE',
        --                 'SAFETY',
        --                 'ERROR',
        --             },
        --         })
        --     end,
        --     desc = '[S]earch [N]otes',
        -- },
    },
    opts = {
        signs = false,
        keywords = {
            -- These are "todos"
            TODO = { icon = ' ', color = 'todo', alt = { 'WIP' } },
            FIX = { icon = ' ', color = 'error', alt = { 'FIXME', 'ERROR' } },
            OPTMZE = { icon = ' ', color = 'perf', alt = { 'OPTIMIZE' } },
            SECURE = { icon = '󰣮 ', color = 'warning' },
            -- These are "notes"
            NOTE = { icon = ' ', color = 'note', alt = { 'INFO', 'DOCS' } },
            TEST = { icon = '󰙨 ', color = 'note' },
            WARN = { icon = ' ', color = 'warning', alt = { 'WARNING', 'SECURITY' } },
            HACK = { icon = ' ', color = 'warning' },
            IMPORTANT = { icon = ' ', color = 'warning' },
            PERF = { icon = ' ', color = 'perf' },
            STUDY = { icon = ' ', color = 'perf' },
            UNSAFE = { icon = '󰍛 ', color = 'error', alt = { 'SAFETY' } },
        },
        highlight = {
            before = '', -- "fg" or "bg" or empty
            keyword = '', -- "wide" or empty
            after = '', -- "fg" or empty
            pattern = { [[.*<((KEYWORDS)%(\(.{-1,}\))?):]] }, -- vim regex
            comments_only = false,
        },
        colors = {
            todo = { '@comment.todo' },
            note = { '@comment.todo' },
            warning = { '@comment.warning' },
            error = { '@comment.error' },
            perf = { '@comment.perf' },
        },
        search = {
            command = 'rg',
            args = {
                '--color=never',
                '--no-heading',
                '--with-filename',
                '--line-number',
                '--column',
                '--hidden', -- show todos in hidden directories and files
                '--follow', -- follow symlinks
            },
            pattern = [[\b(KEYWORDS)\s*(\([^\)]*\))?\s*:]],
        },
    },
}