summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/todo-comments.lua
blob: 25a63309b5624e6f8dc5290db2f612f305b68a1e (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
-- NORMAL: lorem ipsum
-- TODO: lorem ipsum
-- FIX: lorem ipsum
-- OPTIMIZE: lorem ipsum
-- WARN: lorem ipsum
-- PERF: lorem ipsum
-- HACK: lorem ipsum
-- NOTE: lorem ipsum
-- TEST: lorem ipsum
-- UNSAFE: lorem ipsum
-- TODO(kyren223): lorem ipsum
-- NOTE:(broken) lorem ipsum
-- todo!(a);
-- todo!(aaa);
-- Test
-- TODO: blabla

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', 'BUG', 'OPTIMIZE', 'SECURE' },
                })
            end,
            desc = '[S]earch [T]odos',
        },
        {
            '<leader>sn',
            function()
                Snacks.picker.todo_comments({
                    layout = 'telescope',
                    follow = true,
                    hidden = true,
                })
            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', 'BUG' } },
            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' },
            PERF = { 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*:]],
        },
    },
}