Add lua type annotation and make sure to use opts where possible

This commit is contained in:
2025-05-31 00:47:06 +02:00
parent d2a4babb2e
commit 6c49b81f5a
35 changed files with 362 additions and 263 deletions
@@ -1,6 +1,8 @@
-- https://github.com/folke/todo-comments.nvim
local diagnostic = require("symbols.diagnostic")
--- @module "lazy"
--- @type LazySpec
return {
-- 'folke/todo-comments.nvim',
-- NOTE: This fork highlights the entire matched word, not just the keyword.
@@ -8,7 +10,42 @@ return {
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
opts = {
keywords = {
-- FIX: Fix
FIX = { icon = diagnostic.bug },
-- TODO: Todo
TODO = { icon = diagnostic.todo },
-- HACK: Hack
HACK = { icon = diagnostic.hack },
-- WARN: Warn
WARN = { icon = diagnostic.warn },
-- PERF: Perf
PERF = { icon = diagnostic.performance },
-- NOTE: Note
NOTE = { icon = diagnostic.note },
-- TEST: Test
TEST = { icon = diagnostic.test },
},
highlight = {
-- TODO: Have multiline, but end when %p (punctuation) is at the end of a line
multiline = false,
before = "fg",
pattern = [[(KEYWORDS)\s*(\([^\)]*\))?:]],
},
search = {
pattern = [[\b(KEYWORDS)(\(.*\))?:]],
},
colors = {
error = { "TodoCommentError" },
warning = { "TodoCommentWarning" },
info = { "TodoCommentInfo" },
hint = { "TodoCommentHint" },
test = { "TodoCommentTest" },
default = { "TodoCommentDefault" },
},
},
init = function()
vim.keymap.set("n", "]t", function()
require("todo-comments").jump_next()
end, { desc = "Next todo comment" })
@@ -25,41 +62,5 @@ return {
if pcall(require, "telescope") then
vim.keymap.set("n", "<leader>st", "<cmd>TodoTelescope<cr>", { desc = "Search todo" })
end
require("todo-comments").setup({
keywords = {
-- FIX: Fix
FIX = { icon = diagnostic.bug },
-- TODO: Todo
TODO = { icon = diagnostic.todo },
-- HACK: Hack
HACK = { icon = diagnostic.hack },
-- WARN: Warn
WARN = { icon = diagnostic.warn },
-- PERF: Perf
PERF = { icon = diagnostic.performance },
-- NOTE: Note
NOTE = { icon = diagnostic.note },
-- TEST: Test
TEST = { icon = diagnostic.test },
},
highlight = {
-- TODO: Have multiline, but end when %p (punctuation) is at the end of a line
multiline = false,
before = "fg",
pattern = [[(KEYWORDS)\s*(\([^\)]*\))?:]],
},
search = {
pattern = [[\b(KEYWORDS)(\(.*\))?:]],
},
colors = {
error = { "TodoCommentError" },
warning = { "TodoCommentWarning" },
info = { "TodoCommentInfo" },
hint = { "TodoCommentHint" },
test = { "TodoCommentTest" },
default = { "TodoCommentDefault" },
},
})
end,
}