mirror of https://github.com/sgoudham/nvim.git
refactor(highlight): Resolve conflict
commit
8891abfe29
@ -0,0 +1,102 @@
|
||||
---@class Config
|
||||
local config = {}
|
||||
|
||||
config.options = {
|
||||
transparent_background = false,
|
||||
term_colors = false,
|
||||
dim_inactive = {
|
||||
enable = false,
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
styles = {
|
||||
comments = { "italic" },
|
||||
conditionals = { "italic" },
|
||||
<<<<<<< HEAD
|
||||
loops = {},
|
||||
functions = {},
|
||||
keywords = {},
|
||||
strings = {},
|
||||
variables = {},
|
||||
numbers = {},
|
||||
booleans = {},
|
||||
properties = {},
|
||||
types = {},
|
||||
operators = {},
|
||||
=======
|
||||
loops = "NONE",
|
||||
functions = "NONE",
|
||||
keywords = "NONE",
|
||||
strings = "NONE",
|
||||
variables = "NONE",
|
||||
numbers = "NONE",
|
||||
booleans = "NONE",
|
||||
properties = "NONE",
|
||||
types = "NONE",
|
||||
operators = "NONE",
|
||||
>>>>>>> origin/dev
|
||||
},
|
||||
integrations = {
|
||||
treesitter = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = { "italic" },
|
||||
hints = { "italic" },
|
||||
warnings = { "italic" },
|
||||
information = { "italic" },
|
||||
},
|
||||
underlines = {
|
||||
errors = { "underline" },
|
||||
hints = { "underline" },
|
||||
warnings = { "underline" },
|
||||
information = { "underline" },
|
||||
},
|
||||
},
|
||||
coc_nvim = false,
|
||||
lsp_trouble = false,
|
||||
cmp = true,
|
||||
lsp_saga = false,
|
||||
gitgutter = false,
|
||||
gitsigns = true,
|
||||
telescope = true,
|
||||
nvimtree = {
|
||||
enabled = true,
|
||||
show_root = false,
|
||||
transparent_panel = false,
|
||||
},
|
||||
neotree = {
|
||||
enabled = false,
|
||||
show_root = false,
|
||||
transparent_panel = false,
|
||||
},
|
||||
which_key = false,
|
||||
indent_blankline = {
|
||||
enabled = true,
|
||||
colored_indent_levels = false,
|
||||
},
|
||||
dashboard = true,
|
||||
neogit = false,
|
||||
vim_sneak = false,
|
||||
fern = false,
|
||||
barbar = false,
|
||||
bufferline = true,
|
||||
markdown = true,
|
||||
lightspeed = false,
|
||||
leap = false,
|
||||
ts_rainbow = false,
|
||||
hop = false,
|
||||
notify = true,
|
||||
telekasten = true,
|
||||
symbols_outline = true,
|
||||
},
|
||||
color_overrides = {},
|
||||
custom_highlights = {},
|
||||
}
|
||||
|
||||
function config.set_options(opts)
|
||||
opts = opts or {}
|
||||
config.options = vim.tbl_deep_extend("force", config.options, opts)
|
||||
end
|
||||
|
||||
return config
|
@ -0,0 +1,16 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } },
|
||||
<<<<<<< HEAD
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = { "bold" } },
|
||||
=======
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" },
|
||||
>>>>>>> origin/dev
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,16 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } },
|
||||
<<<<<<< HEAD
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = { "bold" } },
|
||||
=======
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" },
|
||||
>>>>>>> origin/dev
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,16 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } },
|
||||
<<<<<<< HEAD
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = { "bold" } },
|
||||
=======
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" },
|
||||
>>>>>>> origin/dev
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = "bold,underline" },
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" },
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = "bold,italic" },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = "bold,underline" },
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" },
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = "bold,italic" },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } },
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = { "bold" } },
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } },
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = { "bold" } },
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } },
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" },
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
return {
|
||||
HopNextKey = { bg = cp.base, fg = cp.peach, style = { "bold", "underline" } },
|
||||
HopNextKey1 = { bg = cp.base, fg = cp.blue, style = "bold" },
|
||||
HopNextKey2 = { bg = cp.base, fg = cp.teal, style = { "bold", "italic" } },
|
||||
HopUnmatched = { bg = cp.base, fg = cp.overlay0 },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,124 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(cp)
|
||||
-- local delimeters = cp.overlay2
|
||||
local operators = cp.sky
|
||||
local cl = cp.mauve -- conditionals, loops
|
||||
local keywords = cp.mauve
|
||||
|
||||
local math_logic = cp.peach
|
||||
return {
|
||||
-- These groups are for the neovim tree-sitter highlights.
|
||||
-- As of writing, tree-sitter support is a WIP, group names may change.
|
||||
-- By default, most of these groups link to an appropriate Vim group,
|
||||
-- TSError -> Error for example, so you do not have to define these unless
|
||||
-- you explicitly want to support Treesitter's improved syntax awareness.
|
||||
TSField = { fg = cp.teal }, -- For fields.
|
||||
TSProperty = { fg = cp.teal, style = cnf.styles.properties or {} }, -- Same as TSField.
|
||||
|
||||
TSInclude = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua.
|
||||
TSOperator = { fg = operators, style = cnf.styles.operators or {} }, -- For any operator: +, but also -> and * in cp.
|
||||
TSKeywordOperator = { fg = cp.mauve, style = cnf.styles.operators or {} }, -- For new keyword operator
|
||||
TSPunctSpecial = { fg = cp.sky, style = cnf.styles.operators or {} }, -- For special punctutation that does not fall in the catagories before.
|
||||
|
||||
TSFloat = { fg = math_logic, style = cnf.styles.numbers or {} }, -- For floats.
|
||||
TSNumber = { fg = math_logic, style = cnf.styles.numbers or {} }, -- For all numbers
|
||||
TSBoolean = { fg = math_logic, style = cnf.styles.booleans or {} }, -- For booleans.
|
||||
|
||||
TSConstructor = { fg = cp.sapphire }, -- For constructor calls and definitions: = { } in Lua, and Java constructors.
|
||||
TSConstant = { fg = cp.peach }, -- For constants
|
||||
TSConditional = { fg = cl, style = cnf.styles.conditionals or {} }, -- For keywords related to conditionnals.
|
||||
TSRepeat = { fg = cl, style = cnf.styles.loops or {} }, -- For keywords related to loops.
|
||||
TSException = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For exception related keywords.
|
||||
|
||||
-- builtin
|
||||
TSConstBuiltin = { fg = cp.peach, style = cnf.styles.keywords or {} }, -- For constant that are built in the language: nil in Lua.
|
||||
TSFuncBuiltin = { fg = cp.peach, style = cnf.styles.functions or {} }, -- For builtin functions: table.insert in Lua.
|
||||
|
||||
TSNamespace = { fg = cp.blue, style = { "italic" } }, -- For identifiers referring to modules and namespaces.
|
||||
TSType = { fg = cp.yellow, style = cnf.styles.types or {} }, -- For types.
|
||||
TSTypeBuiltin = { fg = cp.yellow, style = cnf.styles.properties or "italic" }, -- For builtin types.
|
||||
TSVariableBuiltin = { fg = cp.red }, -- Variable names that are defined by the languages, like this or self.
|
||||
|
||||
TSFunction = { fg = cp.blue, style = cnf.styles.functions or {} }, -- For function (calls and definitions).
|
||||
TSFuncMacro = { fg = cp.teal, style = cnf.styles.functions or {} }, -- For macro defined functions (calls and definitions): each macro_rules in Ruscp.
|
||||
TSParameter = { fg = cp.maroon, style = { "italic" } }, -- For parameters of a function.
|
||||
TSKeywordFunction = { fg = cp.mauve, style = cnf.styles.keywords or {} }, -- For keywords used to define a fuction.
|
||||
TSKeyword = { fg = keywords, style = cnf.styles.keywords or {} }, -- For keywords that don't fall in previous categories.
|
||||
TSKeywordReturn = { fg = cp.mauve, style = cnf.styles.keywords or {} },
|
||||
-- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
|
||||
-- TSAttribute = { }; -- (unstable) TODO: docs
|
||||
-- TSCharacter = { }; -- For characters.
|
||||
-- TSoverlay0 = { }; -- For overlay0 blocks.
|
||||
TSNote = { fg = cp.base, bg = cp.blue },
|
||||
TSWarning = { fg = cp.base, bg = cp.yellow },
|
||||
TSDanger = { fg = cp.base, bg = cp.red },
|
||||
TSConstMacro = { fg = cp.mauve }; -- For constants that are defined by macros: NULL in cp.
|
||||
-- TSError = { fg = cp.red }, -- For syntax/parser errors.
|
||||
-- rustTSField = { fg = cp.surface1 }, -- For fields.
|
||||
TSLabel = { fg = cp.sapphire }, -- For labels: label: in C and :label: in Lua.
|
||||
TSMethod = { fg = cp.blue, style = cnf.styles.functions or {} }, -- For method calls and definitions.
|
||||
-- TSNone = { }; -- TODO: docs
|
||||
-- TSParameterReference= { }; -- For references to parameters of a function.
|
||||
tomlTSProperty = { fg = cp.blue }, -- Differentiates between string and properties
|
||||
TSPunctDelimiter = { fg = cp.overlay2 }, -- For delimiters ie: .
|
||||
-- TSPunctBracket = { fg = delimeters }, -- For brackets and parenthesis.
|
||||
TSPunctBracket = { fg = cp.overlay2 }, -- For brackets and parenthesis.
|
||||
TSString = { fg = cp.green, style = cnf.styles.strings or {} }, -- For strings.
|
||||
TSStringRegex = { fg = cp.peach, style = cnf.styles.strings or {} }, -- For regexes.
|
||||
-- TSSymbol = { }; -- For identifiers referring to symbols or atoms.
|
||||
TSVariable = { fg = cp.text, style = cnf.styles.variables or {} }, -- Any variable name that does not have another highlighcp.
|
||||
TSTagAttribute = { fg = cp.teal, style = { "italic" } }, -- Tags like html tag names.
|
||||
TSTag = { fg = cp.mauve }, -- Tags like html tag names.
|
||||
TSTagDelimiter = { fg = cp.sky }, -- Tag delimiter like < > /
|
||||
TSText = { fg = cp.text }, -- For strings considerated text in a markup language.
|
||||
-- TSEmphasis = { }; -- For text to be represented with emphasis.
|
||||
-- TSUnderline = { }; -- For text to be represented with an underline.
|
||||
-- TSStrike = { }; -- For strikethrough texcp.
|
||||
-- TSTitle = { }; -- Text that is part of a title.
|
||||
-- TSLiteral = { }; -- Literal texcp.
|
||||
-- TSURI = { }; -- Any URI like a link or email.
|
||||
--
|
||||
-- Markdown tresitter parser support
|
||||
TSURI = { fg = cp.rosewater, style = { "italic", "underline" } }, -- urls, links and emails
|
||||
<<<<<<< HEAD
|
||||
TSLiteral = { fg = cp.teal, style = { "italic" } }, -- used for inline code in markdown and for doc in python (""")
|
||||
TSTextReference = { fg = cp.lavender, style = { "bold" } }, -- references
|
||||
TSTitle = { fg = cp.blue, style = { "bold" } }, -- titles like: # Example
|
||||
TSEmphasis = { fg = cp.maroon, style = { "italic" } }, -- bold
|
||||
TSStrong = { fg = cp.maroon, style = { "bold" } }, -- italic
|
||||
=======
|
||||
TSLiteral = { fg = cp.teal, style = "italic" }, -- used for inline code in markdown and for doc in python (""")
|
||||
TSTextReference = { fg = cp.lavender, style = "bold" }, -- references
|
||||
TSTitle = { fg = cp.blue, style = "bold" }, -- titles like: # Example
|
||||
TSEmphasis = { fg = cp.maroon, style = "italic" }, -- bold
|
||||
TSStrong = { fg = cp.maroon, style = "bold" }, -- italic
|
||||
>>>>>>> origin/dev
|
||||
TSStringEscape = { fg = cp.pink, style = cnf.styles.strings }, -- For escape characters within a string.
|
||||
|
||||
-- bash
|
||||
-- bashTSFuncBuiltin = { fg = cp.red, style = { "italic" } },
|
||||
-- bashTSParameter = { fg = cp.yellow, style = { "italic" } },
|
||||
|
||||
-- json
|
||||
jsonTSLabel = { fg = cp.blue }, -- For labels: label: in C and :label: in Lua.
|
||||
|
||||
-- lua
|
||||
luaTSConstructor = { fg = cp.lavender }, -- For constructor calls and definitions: = { } in Lua, and Java constructors.
|
||||
|
||||
-- typescript
|
||||
typescriptTSConstructor = { fg = cp.lavender },
|
||||
|
||||
-- TSX (Typescript React)
|
||||
tsxTSConstructor = { fg = cp.lavender },
|
||||
tsxTSTagAttribute = { fg = cp.mauve },
|
||||
|
||||
-- cpp
|
||||
cppTSProperty = { fg = cp.rosewater },
|
||||
|
||||
-- yaml
|
||||
yamlTSField = { fg = cp.blue }, -- For fields.
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,115 @@
|
||||
local g = vim.g
|
||||
local util = {}
|
||||
|
||||
local has_nvim07 = vim.fn.has("nvim-0.7")
|
||||
|
||||
function util.highlight(group, color)
|
||||
if has_nvim07 then
|
||||
if color.link then
|
||||
vim.api.nvim_set_hl(0, group, {
|
||||
link = color.link,
|
||||
})
|
||||
else
|
||||
if color.style then
|
||||
<<<<<<< HEAD
|
||||
for _, style in ipairs(color.style) do
|
||||
color[style] = true
|
||||
=======
|
||||
if color.style ~= "NONE" then
|
||||
if type(color.style) == "table" then
|
||||
for _, style in ipairs(color.style) do
|
||||
color[style] = true
|
||||
end
|
||||
else
|
||||
color[color.style] = true
|
||||
end
|
||||
>>>>>>> origin/dev
|
||||
end
|
||||
end
|
||||
|
||||
color.style = nil
|
||||
vim.api.nvim_set_hl(0, group, color)
|
||||
end
|
||||
<<<<<<< HEAD
|
||||
else -- Doc: :h highlight-gui
|
||||
if color.style then
|
||||
color.style = table.concat(color.style, ",")
|
||||
end
|
||||
local style = (color.style and color.style ~= "") and "gui=" .. color.style or "gui=NONE"
|
||||
=======
|
||||
else
|
||||
-- Doc: :h highlight-gui
|
||||
if color.style and type(color.style) == "table" then
|
||||
color.style = table.concat(color.style, ",")
|
||||
end
|
||||
local style = color.style and "gui=" .. color.style or "gui=NONE"
|
||||
>>>>>>> origin/dev
|
||||
local fg = color.fg and "guifg=" .. color.fg or "guifg=NONE"
|
||||
local bg = color.bg and "guibg=" .. color.bg or "guibg=NONE"
|
||||
local sp = color.sp and "guisp=" .. color.sp or ""
|
||||
local blend = color.blend and "blend=" .. color.blend or ""
|
||||
local hl = "highlight " .. group .. " " .. style .. " " .. fg .. " " .. bg .. " " .. sp .. " " .. blend
|
||||
vim.cmd(hl)
|
||||
if color.link then
|
||||
vim.cmd("highlight! link " .. group .. " " .. color.link)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function util.syntax(tbl)
|
||||
for group, colors in pairs(tbl) do
|
||||
util.highlight(group, colors)
|
||||
end
|
||||
end
|
||||
|
||||
function util.properties(tbl)
|
||||
for property, value in pairs(tbl) do
|
||||
vim.o[property] = value
|
||||
end
|
||||
end
|
||||
|
||||
function util.terminal(cp)
|
||||
g.terminal_color_0 = cp.overlay0
|
||||
g.terminal_color_8 = cp.overlay1
|
||||
|
||||
g.terminal_color_1 = cp.red
|
||||
g.terminal_color_9 = cp.red
|
||||
|
||||
g.terminal_color_2 = cp.green
|
||||
g.terminal_color_10 = cp.green
|
||||
|
||||
g.terminal_color_3 = cp.yellow
|
||||
g.terminal_color_11 = cp.yellow
|
||||
|
||||
g.terminal_color_4 = cp.blue
|
||||
g.terminal_color_12 = cp.blue
|
||||
|
||||
g.terminal_color_5 = cp.pink
|
||||
g.terminal_color_13 = cp.pink
|
||||
|
||||
g.terminal_color_6 = cp.sky
|
||||
g.terminal_color_14 = cp.sky
|
||||
|
||||
g.terminal_color_7 = cp.text
|
||||
g.terminal_color_15 = cp.text
|
||||
end
|
||||
|
||||
function util.load(theme)
|
||||
vim.cmd("hi clear")
|
||||
if vim.fn.exists("syntax_on") then
|
||||
vim.cmd("syntax reset")
|
||||
end
|
||||
g.colors_name = "catppuccin"
|
||||
local custom_highlights = require("catppuccin.config").options.custom_highlights
|
||||
|
||||
util.properties(theme.properties)
|
||||
util.syntax(theme.base)
|
||||
util.syntax(theme.integrations)
|
||||
util.syntax(custom_highlights)
|
||||
|
||||
if require("catppuccin.config").options["term_colors"] then
|
||||
util.terminal(theme.terminal)
|
||||
end
|
||||
end
|
||||
|
||||
return util
|
Loading…
Reference in New Issue