fix(config): allow highlights to be overridable

This commit is contained in:
Matt Leong 2021-10-26 11:44:29 -07:00
parent 95161afa2a
commit d746f70865
4 changed files with 30 additions and 38 deletions

View file

@ -6,7 +6,6 @@ local opts_cursor = {
initial_mode = 'normal', initial_mode = 'normal',
sorting_strategy = 'ascending', sorting_strategy = 'ascending',
layout_strategy = 'cursor', layout_strategy = 'cursor',
preview_title = false,
results_title = false, results_title = false,
layout_config = { layout_config = {
width = 0.5, width = 0.5,
@ -34,6 +33,7 @@ require('telescope').setup({
file_ignore_patterns = { file_ignore_patterns = {
'.git/', '.git/',
}, },
dynamic_preview_title = true,
vimgrep_arguments = { vimgrep_arguments = {
'rg', 'rg',
'--ignore', '--ignore',

View file

@ -1,44 +1,38 @@
local colors = require('cosmic.core.theme.colors') local colors = require('cosmic.core.theme.colors')
local highlight = require('cosmic.utils').highlight local highlight = require('cosmic.utils').highlight
local M = {}
function M.init() -- diagnostic virtual text highlights
-- diagnostic virtual text highlights highlight('DiagnosticVirtualTextError', 'None', colors.error)
highlight('DiagnosticVirtualTextError', 'None', colors.error) highlight('DiagnosticVirtualTextWarn', 'None', colors.warn)
highlight('DiagnosticVirtualTextWarn', 'None', colors.warn) highlight('DiagnosticVirtualTextInfo', 'None', colors.info)
highlight('DiagnosticVirtualTextInfo', 'None', colors.info) highlight('DiagnosticVirtualTextHint', 'None', colors.hint)
highlight('DiagnosticVirtualTextHint', 'None', colors.hint)
-- diagnostics highlight -- diagnostics highlight
highlight('DiagnosticError', 'None', colors.error) highlight('DiagnosticError', 'None', colors.error)
highlight('DiagnosticWarn', 'None', colors.warn) highlight('DiagnosticWarn', 'None', colors.warn)
highlight('DiagnosticInfo', 'None', colors.info) highlight('DiagnosticInfo', 'None', colors.info)
highlight('DiagnosticHint', 'None', colors.hint) highlight('DiagnosticHint', 'None', colors.hint)
highlight('Error', 'None', colors.error) highlight('Error', 'None', colors.error)
highlight('ErrorMsg', 'None', colors.error) highlight('ErrorMsg', 'None', colors.error)
highlight('WarningMsg', 'None', colors.warn) highlight('WarningMsg', 'None', colors.warn)
-- legacy diagnostics highlight -- legacy diagnostics highlight
highlight('LspDiagnosticsError', 'None', colors.error) highlight('LspDiagnosticsError', 'None', colors.error)
highlight('LspDiagnosticsWarn', 'None', colors.warn) highlight('LspDiagnosticsWarn', 'None', colors.warn)
highlight('LspDiagnosticsInfo', 'None', colors.info) highlight('LspDiagnosticsInfo', 'None', colors.info)
highlight('LspDiagnosticsHint', 'None', colors.hint) highlight('LspDiagnosticsHint', 'None', colors.hint)
-- signature highlight color -- signature highlight color
highlight('LspSignatureActiveParameter', 'None', colors.orange) highlight('LspSignatureActiveParameter', 'None', colors.orange)
-- currently not working? -- currently not working?
highlight('TelescopeSelectionCaret', 'None', colors.selection_caret) highlight('TelescopeSelectionCaret', 'None', colors.selection_caret)
-- autocomplete highlights -- autocomplete highlights
highlight('CmpItemAbbrDeprecated', 'None', colors.warn) highlight('CmpItemAbbrDeprecated', 'None', colors.warn)
-- todo: needs to highlight after lsp start, why? idk vim.cmd([[
vim.cmd([[ highlight clear NormalFloat
highlight clear NormalFloat highlight link NormalFloat Normal
highlight link NormalFloat Normal ]])
]])
end
return M

View file

@ -2,6 +2,7 @@ require('cosmic.disabled')
require('cosmic.pluginsInit') require('cosmic.pluginsInit')
require('cosmic.compiled') require('cosmic.compiled')
require('cosmic.editor') require('cosmic.editor')
require('cosmic.core.theme.highlights')
do do
local ok, err = pcall(require, 'cosmic.config.editor') local ok, err = pcall(require, 'cosmic.config.editor')

View file

@ -46,9 +46,6 @@ function M.on_attach(client, bufnr)
border = 'single', border = 'single',
}, },
}, bufnr) }, bufnr)
-- for some reason, highlights have to happen here
require('cosmic.core.theme.highlights').init()
end end
M.flags = { M.flags = {