From 7c0be72d0823ac4b1fdcb85b9c14d3fb1e0023e8 Mon Sep 17 00:00:00 2001 From: Matt Leong Date: Mon, 22 Nov 2021 14:54:10 -0800 Subject: [PATCH] feat(plugins): move some configs to core --- lua/cosmic/core/comments/init.lua | 23 ++++++++++++++++ lua/cosmic/core/notifications/init.lua | 12 ++++++++ lua/cosmic/pluginsInit.lua | 38 ++------------------------ 3 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 lua/cosmic/core/comments/init.lua create mode 100644 lua/cosmic/core/notifications/init.lua diff --git a/lua/cosmic/core/comments/init.lua b/lua/cosmic/core/comments/init.lua new file mode 100644 index 0000000..8b110aa --- /dev/null +++ b/lua/cosmic/core/comments/init.lua @@ -0,0 +1,23 @@ +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' }, + HACK = { icon = icons.flame, color = 'warning' }, + WARN = { icon = icons.warn, color = 'warning', alt = { 'WARNING', 'XXX' } }, + PERF = { icon = icons.perf, alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } }, + NOTE = { icon = icons.note, color = 'hint', alt = { 'INFO' } }, + }, + colors = { + error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' }, + warning = { 'DiagnosticWarning', 'WarningMsg', '#FBBF24' }, + info = { 'DiagnosticInformation', '#2563EB' }, + hint = { 'DiagnosticHint', '#10B981' }, + default = { 'Identifier', '#7C3AED' }, + }, +}) diff --git a/lua/cosmic/core/notifications/init.lua b/lua/cosmic/core/notifications/init.lua new file mode 100644 index 0000000..1ed0b69 --- /dev/null +++ b/lua/cosmic/core/notifications/init.lua @@ -0,0 +1,12 @@ +local icons = require('cosmic.core.theme.icons') +require('notify').setup({ + icons = { + ERROR = icons.error, + WARN = icons.warn, + INFO = icons.info, + DEBUG = icons.debug, + TRACE = icons.trace, + }, + background_colour = require('cosmic.core.theme.colors').notify_bg, +}) +vim.notify = require('notify') diff --git a/lua/cosmic/pluginsInit.lua b/lua/cosmic/pluginsInit.lua index 12c864e..50e1211 100644 --- a/lua/cosmic/pluginsInit.lua +++ b/lua/cosmic/pluginsInit.lua @@ -37,18 +37,7 @@ return packer.startup(function() use({ 'rcarriga/nvim-notify', config = function() - local icons = require('cosmic.core.theme.icons') - require('notify').setup({ - icons = { - ERROR = icons.error, - WARN = icons.warn, - INFO = icons.info, - DEBUG = icons.debug, - TRACE = icons.trace, - }, - background_colour = require('cosmic.core.theme.colors').notify_bg, - }) - vim.notify = require('notify') + require('cosmic.core.notifications') end, after = config.theme, disable = vim.tbl_contains(user_plugins.disable, 'notify'), @@ -234,7 +223,6 @@ return packer.startup(function() 'nvim-treesitter/nvim-treesitter-refactor', }, run = ':TSUpdate', - -- event = 'BufEnter', config = function() require('cosmic.core.treesitter') end, @@ -253,29 +241,7 @@ return packer.startup(function() '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' }, - HACK = { icon = icons.flame, color = 'warning' }, - WARN = { icon = icons.warn, color = 'warning', alt = { 'WARNING', 'XXX' } }, - PERF = { icon = icons.perf, alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } }, - NOTE = { icon = icons.note, color = 'hint', alt = { 'INFO' } }, - }, - colors = { - error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' }, - warning = { 'DiagnosticWarning', 'WarningMsg', '#FBBF24' }, - info = { 'DiagnosticInformation', '#2563EB' }, - hint = { 'DiagnosticHint', '#10B981' }, - default = { 'Identifier', '#7C3AED' }, - }, - }) + require('cosmic.core.comments') end, event = 'BufWinEnter', disable = vim.tbl_contains(user_plugins.disable, 'todo-comments'),