Add lua type annotation and make sure to use opts where possible
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user