From a00aaa63615d06e6a43919fe3402cf5e092e6587 Mon Sep 17 00:00:00 2001 From: Matt Leong Date: Sat, 30 Oct 2021 18:54:10 -0700 Subject: [PATCH] feat(plugins): add todo highlight --- lua/cosmic/config/plugins.lua | 5 +++-- lua/cosmic/core/theme/icons.lua | 8 ++++++-- lua/cosmic/pluginsInit.lua | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/lua/cosmic/config/plugins.lua b/lua/cosmic/config/plugins.lua index c534e78..f529b9e 100644 --- a/lua/cosmic/config/plugins.lua +++ b/lua/cosmic/config/plugins.lua @@ -17,10 +17,11 @@ local plugins = { 'gitsigns', 'kommentary', 'statusline', - 'theme', -- if default theme is disabled, you will need to update add your own statusline - 'treesitter', 'telescope', 'terminal', + 'theme', -- if default theme is disabled, you will need to update add your own statusline + 'todo-comments', + 'treesitter', 'nvim-tree', }, } diff --git a/lua/cosmic/core/theme/icons.lua b/lua/cosmic/core/theme/icons.lua index f0dab12..4208529 100644 --- a/lua/cosmic/core/theme/icons.lua +++ b/lua/cosmic/core/theme/icons.lua @@ -5,18 +5,22 @@ local icons = { arrow_right_filled = '', -- e0b0 arrow_left = '', -- e0b3 arrow_right = '', -- e0b1 - ghost = '', + ghost = ' ', warn = '', info = '', error = '', hint = '', + perf = ' ', + note = ' ', branch = '', file = '', dotdotdot = '…', information = '', symlink = '', line_number = '', - debug = '', + debug = ' ', + flame = ' ', + check = ' ', trace = '✎', git = { unstaged = '✗', diff --git a/lua/cosmic/pluginsInit.lua b/lua/cosmic/pluginsInit.lua index da7cdd6..cd5fb55 100644 --- a/lua/cosmic/pluginsInit.lua +++ b/lua/cosmic/pluginsInit.lua @@ -216,6 +216,38 @@ return packer.startup(function() disable = vim.tbl_contains(user_plugins.disable, 'kommentary'), }) + -- todo highlights + use({ + 'folke/todo-comments.nvim', + requires = 'nvim-lua/plenary.nvim', + config = function() + local icons = require('cosmic.core.theme.icons') + require('todo-comments').setup({ + keywords = { + FIX = { + icon = icons.debug, -- icon used for the sign, and in search results + color = 'error', -- can be a hex color, or a named color (see below) + alt = { 'FIXME', 'BUG', 'FIXIT', 'ISSUE', 'fix', 'fixme', 'bug' }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = icons.check, color = 'info', alt = { 'todo' } }, + HACK = { icon = icons.flame, color = 'warning', alt = { 'hack' } }, + WARN = { icon = icons.warn, color = 'warning', alt = { 'WARNING', 'XXX', 'warn', 'warning' } }, + PERF = { icon = icons.perf, alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE', 'perf', 'performance' } }, + NOTE = { icon = icons.note, color = 'hint', alt = { 'INFO', 'note' } }, + }, + colors = { + error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' }, + warning = { 'DiagnosticWarning', 'WarningMsg', '#FBBF24' }, + info = { 'DiagnosticInformation', '#2563EB' }, + hint = { 'DiagnosticHint', '#10B981' }, + default = { 'Identifier', '#7C3AED' }, + }, + }) + end, + event = 'BufRead', + disable = vim.tbl_contains(user_plugins.disable, 'todo-comments'), + }) -- colorized hex codes use({ 'norcalli/nvim-colorizer.lua',