feat!: nvim-treesitter changes

This commit is contained in:
Michael Chris Lopez
2022-10-22 09:32:57 +08:00
parent 6455bdfa0e
commit bfb2e0d43a
17 changed files with 205 additions and 196 deletions

View File

@@ -32,7 +32,7 @@ jobs:
vimdoc: zenbones vimdoc: zenbones
pandoc: doc/zenbones.md pandoc: doc/zenbones.md
description: "A collection of contrast-based vim/neovim colorschemes" description: "A collection of contrast-based vim/neovim colorschemes"
version: "Vim v8.1 / Nvim 0.6.0" version: "Vim v8.1 / Nvim 0.8.0"
- name: Create PR - name: Create PR
run: | run: |
if ! [[ -z $(git status -s) ]]; then if ! [[ -z $(git status -s) ]]; then

View File

@@ -14,6 +14,10 @@ or try the [built-in collection](#usage).
<em>A rock garden in <a href="https://en.wikipedia.org/wiki/Ry%C5%8Dan-ji">Ryōan-ji</a>.</em> <em>A rock garden in <a href="https://en.wikipedia.org/wiki/Ry%C5%8Dan-ji">Ryōan-ji</a>.</em>
</p> </p>
## Requirement
- Neovim v0.8.0 (use v2.0.0 for older versions)
## Recommended setup ## Recommended setup
- Neovim with true colors support i.e. `set termguicolors`. Vim works but only - Neovim with true colors support i.e. `set termguicolors`. Vim works but only

View File

@@ -162,7 +162,7 @@ local lush = require "lush"
local hsluv = lush.hsluv -- Human-friendly hsl local hsluv = lush.hsluv -- Human-friendly hsl
local util = require "zenbones.util" local util = require "zenbones.util"
local bg = vim.opt.background:get() local bg = vim.o.background
-- Define a palette. Use `palette_extend` to fill unspecified colors -- Define a palette. Use `palette_extend` to fill unspecified colors
-- Based on https://github.com/gruvbox-community/gruvbox#palette -- Based on https://github.com/gruvbox-community/gruvbox#palette

View File

@@ -183,7 +183,7 @@ following:
local hsluv = lush.hsluv -- Human-friendly hsl local hsluv = lush.hsluv -- Human-friendly hsl
local util = require "zenbones.util" local util = require "zenbones.util"
local bg = vim.opt.background:get() local bg = vim.o.background
-- Define a palette. Use `palette_extend` to fill unspecified colors -- Define a palette. Use `palette_extend` to fill unspecified colors
-- Based on https://github.com/gruvbox-community/gruvbox#palette -- Based on https://github.com/gruvbox-community/gruvbox#palette

View File

@@ -1,6 +1,6 @@
local lush = require "lush" local lush = require "lush"
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("forestbones.palette")[bg] local p = require("forestbones.palette")[bg]
local specs = generator.generate(p, bg, generator.get_global_config("forestbones", bg)) local specs = generator.generate(p, bg, generator.get_global_config("forestbones", bg))

View File

@@ -1,5 +1,5 @@
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("kanagawabones.palette")[bg] local p = require("kanagawabones.palette")[bg]
return generator.generate(p, bg, generator.get_global_config("kanagawabones", bg)) return generator.generate(p, bg, generator.get_global_config("kanagawabones", bg))

View File

@@ -1,7 +1,7 @@
local lush = require "lush" local lush = require "lush"
local hsluv = lush.hsluv local hsluv = lush.hsluv
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("neobones.palette")[bg] local p = require("neobones.palette")[bg]
local specs = generator.generate(p, bg, generator.get_global_config("neobones", bg)) local specs = generator.generate(p, bg, generator.get_global_config("neobones", bg))

View File

@@ -1,6 +1,6 @@
local lush = require "lush" local lush = require "lush"
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("rosebones.palette")[bg] local p = require("rosebones.palette")[bg]
local specs = generator.generate(p, bg, generator.get_global_config("rosebones", bg)) local specs = generator.generate(p, bg, generator.get_global_config("rosebones", bg))

View File

@@ -1,6 +1,6 @@
local lush = require "lush" local lush = require "lush"
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("seoulbones.palette")[bg] local p = require("seoulbones.palette")[bg]
local specs = generator.generate(p, bg, generator.get_global_config("seoulbones", bg)) local specs = generator.generate(p, bg, generator.get_global_config("seoulbones", bg))

View File

@@ -1,6 +1,6 @@
local lush = require "lush" local lush = require "lush"
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("tokyobones.palette")[bg] local p = require("tokyobones.palette")[bg]
local specs = generator.generate(p, bg, generator.get_global_config("tokyobones", bg)) local specs = generator.generate(p, bg, generator.get_global_config("tokyobones", bg))

View File

@@ -1,5 +1,5 @@
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("zenbones.palette")[bg] local p = require("zenbones.palette")[bg]
return generator.generate(p, bg, generator.get_global_config("zenbones", bg)) return generator.generate(p, bg, generator.get_global_config("zenbones", bg))

View File

@@ -1,7 +1,7 @@
local M = {} local M = {}
local function make_specs(specs_name, ness) local function make_specs(specs_name, ness)
local background = vim.opt.background:get() local background = vim.o.background
package.loaded[specs_name] = nil package.loaded[specs_name] = nil
if ness == nil then if ness == nil then
return require(specs_name) return require(specs_name)
@@ -26,7 +26,7 @@ local function make_env(colorscheme)
transform = require "zenbones.shipwright.transform", transform = require "zenbones.shipwright.transform",
} }
vim.opt.background = colorscheme.background vim.o.background = colorscheme.background
env.specs = make_specs(specs_name) env.specs = make_specs(specs_name)
local ness = colorscheme.background == "light" and { "dim", "bright" } or { "stark", "warm" } local ness = colorscheme.background == "light" and { "dim", "bright" } or { "stark", "warm" }
env["specs_" .. ness[1]] = make_specs(specs_name, ness[1]) env["specs_" .. ness[1]] = make_specs(specs_name, ness[1])

View File

@@ -1,11 +1,7 @@
local function to_vim_autoload(colorscheme) local function to_vim_autoload(colorscheme)
local vimcolors, term = unpack(colorscheme) local vimcolors, term = unpack(colorscheme)
local termcolors = ""
for i, v in ipairs(term) do
termcolors = termcolors .. string.format("let g:terminal_color_%s = '%s'\n", (i - 1), v)
end
termcolors = { local termcolors = {
string.format("let g:terminal_color_0 = '%s'", term.black), string.format("let g:terminal_color_0 = '%s'", term.black),
string.format("let g:terminal_color_1 = '%s'", term.red), string.format("let g:terminal_color_1 = '%s'", term.red),
string.format("let g:terminal_color_2 = '%s'", term.green), string.format("let g:terminal_color_2 = '%s'", term.green),
@@ -43,8 +39,15 @@ run(
specs, specs,
lushwright.to_vimscript, lushwright.to_vimscript,
lushwright.vim_compatible_vimscript, lushwright.vim_compatible_vimscript,
function(vimcolors) function(colors)
return { vimcolors, term } -- filter out treesitter
local vimcolors = vim.tbl_filter(function(color)
return not string.match(color, "@")
end, colors)
return {
vimcolors,
term,
}
end, end,
to_vim_autoload, to_vim_autoload,
{ prepend, [[" This codeblock is auto-generated by shipwright.nvim]] }, { prepend, [[" This codeblock is auto-generated by shipwright.nvim]] },
@@ -62,7 +65,7 @@ run(
local function remove_italics(specs) local function remove_italics(specs)
local italic_specs = {} local italic_specs = {}
for key, hl in pairs(specs) do for key, hl in pairs(specs) do
if hl.gui == "italic" and key ~= "Italic" then if hl.gui == "italic" and key ~= "Italic" and not string.match(key, "@") then
table.insert(italic_specs, string.format("highlight %s gui=NONE cterm=NONE", key)) table.insert(italic_specs, string.format("highlight %s gui=NONE cterm=NONE", key))
end end
end end

View File

@@ -23,20 +23,11 @@ local function generate(p, opt)
---@diagnostic disable: undefined-global ---@diagnostic disable: undefined-global
-- selene: allow(undefined_variable) -- selene: allow(undefined_variable)
-- stylua: ignore start -- stylua: ignore start
local base = lush(function() local base = lush(function(injected_functions)
-- functions are injected via a table for future expansion
-- you probably want to alias it locally
local sym = injected_functions.sym
return { return {
-- The following are all the Neovim default highlight groups from the docs
-- as of 0.5.0-nightly-446, to aid your theme creation. Your themes should
-- probably style all of these at a bare minimum.
--
-- Referenced/linked groups must come before being referenced/lined,
-- so the order shown ((mostly) alphabetical) is likely
-- not the order you will end up with.
--
-- You can uncomment these and leave them empty to disable any
-- styling for that group (meaning they mostly get styled as Normal)
-- or leave them commented to apply vims default colouring or linking.
Normal { bg = not opt.transparent_background and p1.bg or "NONE", fg = p.fg }, -- normal text Normal { bg = not opt.transparent_background and p1.bg or "NONE", fg = p.fg }, -- normal text
Underlined { gui = "underline" }, -- (preferred) text that stands out, HTML links Underlined { gui = "underline" }, -- (preferred) text that stands out, HTML links
@@ -193,77 +184,86 @@ local function generate(p, opt)
DiagnosticUnderlineInfo { fg = opt.colorize_diagnostic_underline_text and DiagnosticInfo.fg or "NONE", gui = "undercurl", sp = DiagnosticInfo.fg }, DiagnosticUnderlineInfo { fg = opt.colorize_diagnostic_underline_text and DiagnosticInfo.fg or "NONE", gui = "undercurl", sp = DiagnosticInfo.fg },
DiagnosticUnderlineHint { fg = opt.colorize_diagnostic_underline_text and DiagnosticHint.fg or "NONE", gui = "undercurl", sp = DiagnosticHint.fg }, DiagnosticUnderlineHint { fg = opt.colorize_diagnostic_underline_text and DiagnosticHint.fg or "NONE", gui = "undercurl", sp = DiagnosticHint.fg },
-- These groups are for the neovim tree-sitter highlights. -- Tree-sitter
-- As of writing, tree-sitter support is a WIP, group names may change. sym "@annotation" { PreProc },
-- By default, most of these groups link to an appropriate Vim group, sym "@attribute" { PreProc },
-- TSError -> Error for example, so you do not have to define these unless sym "@boolean" { Number },
-- you explicitly want to support Treesitter's improved syntax awareness. sym "@character" { Constant },
sym "@character.special" { Special },
sym "@comment" { Comment },
sym "@conditional" { Statement },
sym "@constant" { Identifier, gui = "bold" },
sym "@constant.builtin" { Number },
sym "@constant.macro" { Number },
sym "@constructor" { Special },
sym "@debug" { Special },
sym "@define" { PreProc },
sym "@exception" { Statement },
sym "@field" { Identifier },
sym "@float" { Number },
sym "@function" { Function },
sym "@function.builtin" { Special },
sym "@function.call" { Function },
sym "@function.macro" { PreProc },
sym "@include" { PreProc },
sym "@keyword" { Statement },
sym "@keyword.function" { Statement },
sym "@keyword.operator" { Statement },
sym "@keyword.return" { Statement },
sym "@label" { Statement },
sym "@method" { Function },
sym "@method.call" { Function },
sym "@namespace" { Special },
sym "@none" { },
sym "@number" { Number },
sym "@operator" { Statement },
sym "@parameter" { Identifier },
sym "@parameter.reference" { sym "@parameter" },
sym "@preproc" { PreProc },
sym "@property" { Identifier },
sym "@punctuation.bracket" { Delimiter },
sym "@punctuation.delimiter" { Delimiter },
sym "@punctuation.special" { Delimiter },
sym "@repeat" { Statement },
sym "@storageclass" { Type },
sym "@string" { Constant },
sym "@string.escape" { Special },
sym "@string.regex" { Constant },
sym "@string.special" { Special },
sym "@symbol" { Identifier },
sym "@tag" { Special },
sym "@tag.attribute" { sym "@property" },
sym "@tag.delimiter" { Delimiter },
sym "@text" { sym "@none" },
sym "@text.danger" { Error },
sym "@text.emphasis" { Italic },
sym "@text.environment" { PreProc },
sym "@text.environment.name" { Type },
sym "@text.literal" { Constant },
sym "@text.math" { Special },
sym "@text.note" { DiagnosticInfo },
sym "@text.reference" { Constant },
sym "@text.strike" { gui = "strikethrough" },
sym "@text.strong" { Bold },
sym "@text.title" { Title },
sym "@text.underline" { Underlined },
sym "@text.uri" { Underlined },
sym "@text.warning" { WarningMsg },
sym "@todo" { Todo },
sym "@type" { Type },
sym "@type.builtin" { Type },
sym "@type.definition" { Type },
sym "@type.qualifier" { Type },
sym "@variable" { Identifier },
sym "@variable.builtin" { Number },
-- TSAnnotation { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. sym "@punctuation.special.markdown" { Special },
-- TSAttribute { }; -- (unstable) TODO: docs sym "@string.escape.markdown" { SpecialKey },
-- TSBoolean { }; -- For booleans. sym "@text.reference.markdown" { Identifier, gui = "underline" },
-- TSCharacter { }; -- For characters. sym "@text.emphasis.markdown" { Italic },
-- TSComment { }; -- For comment blocks. sym "@text.title.markdown" { Statement },
-- TSConstructor { }; -- For constructor calls and definitions: ` { }` in Lua, and Java constructors. sym "@text.literal.markdown" { Type },
-- TSConditional { }; -- For keywords related to conditionnals. sym "@text.uri.markdown" { SpecialComment },
TSConstant { Identifier, gui = "bold" }; -- For constants
TSConstBuiltin { Number }; -- For constant that are built in the language: `nil` in Lua.
TSConstMacro { Number }; -- For constants that are defined by macros: `NULL` in C.
-- TSError { }; -- For syntax/parser errors.
-- TSException { }; -- For exception related keywords.
-- TSField { }; -- For fields.
-- TSFloat { }; -- For floats.
-- TSFunction { }; -- For function (calls and definitions).
-- TSFuncBuiltin { }; -- For builtin functions: `print` in Lua.
-- TSFuncMacro { }; -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust.
-- TSInclude { }; -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
-- TSKeyword { }; -- For keywords that don't fall in previous categories.
-- TSKeywordFunction { }; -- For keywords used to define a fuction.
-- TSLabel { }; -- For labels: `label:` in C and `:label:` in Lua.
-- TSMethod { }; -- For method calls and definitions.
TSNamespace { Special }; -- For identifiers referring to modules and namespaces.
-- TSNone { }; -- TODO: docs
-- TSNumber { }; -- For all numbers
-- TSOperator { }; -- For any operator: `+`, but also `->` and `*` in C.
-- TSParameter { }; -- For parameters of a function.
-- TSParameterReference { }; -- For references to parameters of a function.
-- TSProperty { }; -- Same as `TSField`.
-- TSPunctDelimiter { }; -- For delimiters ie: `.`
-- TSPunctBracket { }; -- For brackets and parens.
-- TSPunctSpecial { }; -- For special punctutation that does not fall in the catagories before.
-- TSRepeat { }; -- For keywords related to loops.
-- TSString { }; -- For strings.
-- TSStringRegex { }; -- For regexes.
-- TSStringEscape { }; -- For escape characters within a string.
-- TSSymbol { }; -- For identifiers referring to symbols or atoms.
-- TSType { }; -- For types.
-- TSTypeBuiltin { }; -- For builtin types.
TSVariable { Identifier }, -- Any variable name that does not have another highlight.
TSVariableBuiltin { Number }; -- Variable names that are defined by the languages, like `this` or `self`.
TSTag { Special }, -- Tags like html tag names.
-- TSTagDelimiter { }; -- Tag delimiter like `<` `>` `/`
-- TSText { }; -- For strings considered text in a markup language.
TSEmphasis { Italic }, -- For text to be represented with emphasis.
TSUnderline { Underlined }, -- For text to be represented with an underline.
TSStrong { Bold }, -- Text to be represented in bold.
-- TSStrike { }; -- For strikethrough text.
-- TSTitle { }; -- Text that is part of a title.
-- TSLiteral { }; -- Literal text.
-- TSURI { }; -- Any URI like a link or email.
TSNote { DiagnosticInfo },
TSWarning { WarningMsg },
TSDanger { Error },
-- TS: Markdown
markdownTSPunctSpecial { Special },
markdownTSStringEscape { SpecialKey },
markdownTSTextReference { Identifier, gui = "underline" },
markdownTSEmphasis { Italic },
markdownTSTitle { Statement },
markdownTSLiteral { Type },
markdownTSURI { SpecialComment },
-- Syntax -- Syntax
diffAdded { fg = p.leaf }, diffAdded { fg = p.leaf },
@@ -277,9 +277,9 @@ local function generate(p, opt)
gitcommitOverflow { WarningMsg }, gitcommitOverflow { WarningMsg },
markdownUrl { markdownTSURI }, markdownUrl { SpecialComment },
markdownCode { markdownTSLiteral }, markdownCode { Type },
markdownLinkText { markdownTSTextReference }, markdownLinkText { Identifier, gui = "underline" },
markdownLinkTextDelimiter { Delimiter }, markdownLinkTextDelimiter { Delimiter },
helpHyperTextEntry { Special }, helpHyperTextEntry { Special },

View File

@@ -1,6 +1,5 @@
local lush = require "lush" local lush = require "lush"
local function generate(p, opt) local function generate(p, opt)
local p1 = { local p1 = {
bg = p.bg, bg = p.bg,
@@ -24,20 +23,11 @@ local function generate(p, opt)
---@diagnostic disable: undefined-global ---@diagnostic disable: undefined-global
-- selene: allow(undefined_variable) -- selene: allow(undefined_variable)
-- stylua: ignore start -- stylua: ignore start
local base = lush(function() local base = lush(function(injected_functions)
-- functions are injected via a table for future expansion
-- you probably want to alias it locally
local sym = injected_functions.sym
return { return {
-- The following are all the Neovim default highlight groups from the docs
-- as of 0.5.0-nightly-446, to aid your theme creation. Your themes should
-- probably style all of these at a bare minimum.
--
-- Referenced/linked groups must come before being referenced/lined,
-- so the order shown ((mostly) alphabetical) is likely
-- not the order you will end up with.
--
-- You can uncomment these and leave them empty to disable any
-- styling for that group (meaning they mostly get styled as Normal)
-- or leave them commented to apply vims default colouring or linking.
Normal { bg = not opt.transparent_background and p1.bg or "NONE", fg = p.fg }, -- normal text Normal { bg = not opt.transparent_background and p1.bg or "NONE", fg = p.fg }, -- normal text
Underlined { gui = "underline" }, -- (preferred) text that stands out, HTML links Underlined { gui = "underline" }, -- (preferred) text that stands out, HTML links
@@ -194,77 +184,86 @@ local function generate(p, opt)
DiagnosticUnderlineInfo { fg = opt.colorize_diagnostic_underline_text and DiagnosticInfo.fg or "NONE", gui = "undercurl", sp = DiagnosticInfo.fg }, DiagnosticUnderlineInfo { fg = opt.colorize_diagnostic_underline_text and DiagnosticInfo.fg or "NONE", gui = "undercurl", sp = DiagnosticInfo.fg },
DiagnosticUnderlineHint { fg = opt.colorize_diagnostic_underline_text and DiagnosticHint.fg or "NONE", gui = "undercurl", sp = DiagnosticHint.fg }, DiagnosticUnderlineHint { fg = opt.colorize_diagnostic_underline_text and DiagnosticHint.fg or "NONE", gui = "undercurl", sp = DiagnosticHint.fg },
-- These groups are for the neovim tree-sitter highlights. -- Tree-sitter
-- As of writing, tree-sitter support is a WIP, group names may change. sym "@annotation" { PreProc },
-- By default, most of these groups link to an appropriate Vim group, sym "@attribute" { PreProc },
-- TSError -> Error for example, so you do not have to define these unless sym "@boolean" { Number },
-- you explicitly want to support Treesitter's improved syntax awareness. sym "@character" { Constant },
sym "@character.special" { Special },
sym "@comment" { Comment },
sym "@conditional" { Statement },
sym "@constant" { Identifier, gui = "bold" },
sym "@constant.builtin" { Number },
sym "@constant.macro" { Number },
sym "@constructor" { Special },
sym "@debug" { Special },
sym "@define" { PreProc },
sym "@exception" { Statement },
sym "@field" { Identifier },
sym "@float" { Number },
sym "@function" { Function },
sym "@function.builtin" { Special },
sym "@function.call" { Function },
sym "@function.macro" { PreProc },
sym "@include" { PreProc },
sym "@keyword" { Statement },
sym "@keyword.function" { Statement },
sym "@keyword.operator" { Statement },
sym "@keyword.return" { Statement },
sym "@label" { Statement },
sym "@method" { Function },
sym "@method.call" { Function },
sym "@namespace" { Special },
sym "@none" { },
sym "@number" { Number },
sym "@operator" { Statement },
sym "@parameter" { Identifier },
sym "@parameter.reference" { sym "@parameter" },
sym "@preproc" { PreProc },
sym "@property" { Identifier },
sym "@punctuation.bracket" { Delimiter },
sym "@punctuation.delimiter" { Delimiter },
sym "@punctuation.special" { Delimiter },
sym "@repeat" { Statement },
sym "@storageclass" { Type },
sym "@string" { Constant },
sym "@string.escape" { Special },
sym "@string.regex" { Constant },
sym "@string.special" { Special },
sym "@symbol" { Identifier },
sym "@tag" { Special },
sym "@tag.attribute" { sym "@property" },
sym "@tag.delimiter" { Delimiter },
sym "@text" { sym "@none" },
sym "@text.danger" { Error },
sym "@text.emphasis" { Italic },
sym "@text.environment" { PreProc },
sym "@text.environment.name" { Type },
sym "@text.literal" { Constant },
sym "@text.math" { Special },
sym "@text.note" { DiagnosticInfo },
sym "@text.reference" { Constant },
sym "@text.strike" { gui = "strikethrough" },
sym "@text.strong" { Bold },
sym "@text.title" { Title },
sym "@text.underline" { Underlined },
sym "@text.uri" { Underlined },
sym "@text.warning" { WarningMsg },
sym "@todo" { Todo },
sym "@type" { Type },
sym "@type.builtin" { Type },
sym "@type.definition" { Type },
sym "@type.qualifier" { Type },
sym "@variable" { Identifier },
sym "@variable.builtin" { Number },
-- TSAnnotation { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. sym "@punctuation.special.markdown" { Special },
-- TSAttribute { }; -- (unstable) TODO: docs sym "@string.escape.markdown" { SpecialKey },
-- TSBoolean { }; -- For booleans. sym "@text.reference.markdown" { Identifier, gui = "underline" },
-- TSCharacter { }; -- For characters. sym "@text.emphasis.markdown" { Italic },
-- TSComment { }; -- For comment blocks. sym "@text.title.markdown" { Statement },
-- TSConstructor { }; -- For constructor calls and definitions: ` { }` in Lua, and Java constructors. sym "@text.literal.markdown" { Type },
-- TSConditional { }; -- For keywords related to conditionnals. sym "@text.uri.markdown" { SpecialComment },
TSConstant { Identifier, gui = "bold" }; -- For constants
TSConstBuiltin { Number }; -- For constant that are built in the language: `nil` in Lua.
TSConstMacro { Number }; -- For constants that are defined by macros: `NULL` in C.
-- TSError { }; -- For syntax/parser errors.
-- TSException { }; -- For exception related keywords.
-- TSField { }; -- For fields.
-- TSFloat { }; -- For floats.
-- TSFunction { }; -- For function (calls and definitions).
-- TSFuncBuiltin { }; -- For builtin functions: `print` in Lua.
-- TSFuncMacro { }; -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust.
-- TSInclude { }; -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
-- TSKeyword { }; -- For keywords that don't fall in previous categories.
-- TSKeywordFunction { }; -- For keywords used to define a fuction.
-- TSLabel { }; -- For labels: `label:` in C and `:label:` in Lua.
-- TSMethod { }; -- For method calls and definitions.
TSNamespace { Special }; -- For identifiers referring to modules and namespaces.
-- TSNone { }; -- TODO: docs
-- TSNumber { }; -- For all numbers
-- TSOperator { }; -- For any operator: `+`, but also `->` and `*` in C.
-- TSParameter { }; -- For parameters of a function.
-- TSParameterReference { }; -- For references to parameters of a function.
-- TSProperty { }; -- Same as `TSField`.
-- TSPunctDelimiter { }; -- For delimiters ie: `.`
-- TSPunctBracket { }; -- For brackets and parens.
-- TSPunctSpecial { }; -- For special punctutation that does not fall in the catagories before.
-- TSRepeat { }; -- For keywords related to loops.
-- TSString { }; -- For strings.
-- TSStringRegex { }; -- For regexes.
-- TSStringEscape { }; -- For escape characters within a string.
-- TSSymbol { }; -- For identifiers referring to symbols or atoms.
-- TSType { }; -- For types.
-- TSTypeBuiltin { }; -- For builtin types.
TSVariable { Identifier }, -- Any variable name that does not have another highlight.
TSVariableBuiltin { Number }; -- Variable names that are defined by the languages, like `this` or `self`.
TSTag { Special }, -- Tags like html tag names.
-- TSTagDelimiter { }; -- Tag delimiter like `<` `>` `/`
-- TSText { }; -- For strings considered text in a markup language.
TSEmphasis { Italic }, -- For text to be represented with emphasis.
TSUnderline { Underlined }, -- For text to be represented with an underline.
TSStrong { Bold }, -- Text to be represented in bold.
-- TSStrike { }; -- For strikethrough text.
-- TSTitle { }; -- Text that is part of a title.
-- TSLiteral { }; -- Literal text.
-- TSURI { }; -- Any URI like a link or email.
TSNote { DiagnosticInfo },
TSWarning { WarningMsg },
TSDanger { Error },
-- TS: Markdown
markdownTSPunctSpecial { Special },
markdownTSStringEscape { SpecialKey },
markdownTSTextReference { Identifier, gui = "underline" },
markdownTSEmphasis { Italic },
markdownTSTitle { Statement },
markdownTSLiteral { Type },
markdownTSURI { SpecialComment },
-- Syntax -- Syntax
diffAdded { fg = p.leaf }, diffAdded { fg = p.leaf },
@@ -278,9 +277,9 @@ local function generate(p, opt)
gitcommitOverflow { WarningMsg }, gitcommitOverflow { WarningMsg },
markdownUrl { markdownTSURI }, markdownUrl { SpecialComment },
markdownCode { markdownTSLiteral }, markdownCode { Type },
markdownLinkText { markdownTSTextReference }, markdownLinkText { Identifier, gui = "underline" },
markdownLinkTextDelimiter { Delimiter }, markdownLinkTextDelimiter { Delimiter },
helpHyperTextEntry { Special }, helpHyperTextEntry { Special },

View File

@@ -6,12 +6,15 @@ function M.apply_colorscheme()
local colors_name = vim.g.colors_name local colors_name = vim.g.colors_name
package.loaded[colors_name] = nil package.loaded[colors_name] = nil
require "lush"(require(colors_name), { force_clean = false }) require "lush"(require(colors_name), { force_clean = false })
local p = require(colors_name .. ".palette")[vim.opt.background:get()] local p = require(colors_name .. ".palette")[vim.o.background]
require("zenbones.term").apply_colors(p) require("zenbones.term").apply_colors(p)
end end
function M.get_colorscheme_list() function M.get_colorscheme_list()
local file = io.open(vim.api.nvim_get_runtime_file("zenbones.json", false)[1], "r") local file = io.open(vim.api.nvim_get_runtime_file("zenbones.json", false)[1], "r")
if not file then
error "zenbones.json not found"
end
local content = file:read "*a" local content = file:read "*a"
file:close() file:close()
return vim.json.decode(content) return vim.json.decode(content)
@@ -40,7 +43,7 @@ function M.get_lualine_theme(name)
if colorscheme.background then if colorscheme.background then
return require(string.format("lualine.themes.%s_%s", name, ness)) return require(string.format("lualine.themes.%s_%s", name, ness))
else else
return require(string.format("lualine.themes.%s_%s_%s", name, vim.opt.background:get(), ness)) return require(string.format("lualine.themes.%s_%s_%s", name, vim.o.background, ness))
end end
end end

View File

@@ -1,5 +1,5 @@
local generator = require "zenbones.specs" local generator = require "zenbones.specs"
local bg = vim.opt.background:get() local bg = vim.o.background
local p = require("zenwritten.palette")[bg] local p = require("zenwritten.palette")[bg]
return generator.generate(p, bg, generator.get_global_config("zenwritten", bg)) return generator.generate(p, bg, generator.get_global_config("zenwritten", bg))