diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 11d6f31..d5557ff 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -32,7 +32,7 @@ jobs: vimdoc: zenbones pandoc: doc/zenbones.md 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 run: | if ! [[ -z $(git status -s) ]]; then diff --git a/README.md b/README.md index 512029b..0ee138c 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ or try the [built-in collection](#usage). A rock garden in Ryōan-ji.

+## Requirement + +- Neovim v0.8.0 (use v2.0.0 for older versions) + ## Recommended setup - Neovim with true colors support i.e. `set termguicolors`. Vim works but only diff --git a/doc/zenbones.md b/doc/zenbones.md index 3b442e1..9b20776 100644 --- a/doc/zenbones.md +++ b/doc/zenbones.md @@ -162,7 +162,7 @@ local lush = require "lush" local hsluv = lush.hsluv -- Human-friendly hsl 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 -- Based on https://github.com/gruvbox-community/gruvbox#palette diff --git a/doc/zenbones.txt b/doc/zenbones.txt index b216084..3034c27 100644 --- a/doc/zenbones.txt +++ b/doc/zenbones.txt @@ -183,7 +183,7 @@ following: local hsluv = lush.hsluv -- Human-friendly hsl 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 -- Based on https://github.com/gruvbox-community/gruvbox#palette diff --git a/lua/forestbones/init.lua b/lua/forestbones/init.lua index 23990fe..ed186c7 100644 --- a/lua/forestbones/init.lua +++ b/lua/forestbones/init.lua @@ -1,6 +1,6 @@ local lush = require "lush" local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("forestbones.palette")[bg] local specs = generator.generate(p, bg, generator.get_global_config("forestbones", bg)) diff --git a/lua/kanagawabones/init.lua b/lua/kanagawabones/init.lua index 26e9c21..ff81c95 100644 --- a/lua/kanagawabones/init.lua +++ b/lua/kanagawabones/init.lua @@ -1,5 +1,5 @@ local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("kanagawabones.palette")[bg] return generator.generate(p, bg, generator.get_global_config("kanagawabones", bg)) diff --git a/lua/neobones/init.lua b/lua/neobones/init.lua index 9562850..9e4c9d4 100644 --- a/lua/neobones/init.lua +++ b/lua/neobones/init.lua @@ -1,7 +1,7 @@ local lush = require "lush" local hsluv = lush.hsluv local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("neobones.palette")[bg] local specs = generator.generate(p, bg, generator.get_global_config("neobones", bg)) diff --git a/lua/rosebones/init.lua b/lua/rosebones/init.lua index ea7370f..11d2f4d 100644 --- a/lua/rosebones/init.lua +++ b/lua/rosebones/init.lua @@ -1,6 +1,6 @@ local lush = require "lush" local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("rosebones.palette")[bg] local specs = generator.generate(p, bg, generator.get_global_config("rosebones", bg)) diff --git a/lua/seoulbones/init.lua b/lua/seoulbones/init.lua index 041cf99..79c4a72 100644 --- a/lua/seoulbones/init.lua +++ b/lua/seoulbones/init.lua @@ -1,6 +1,6 @@ local lush = require "lush" local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("seoulbones.palette")[bg] local specs = generator.generate(p, bg, generator.get_global_config("seoulbones", bg)) diff --git a/lua/tokyobones/init.lua b/lua/tokyobones/init.lua index 5b5006c..0cbfebc 100644 --- a/lua/tokyobones/init.lua +++ b/lua/tokyobones/init.lua @@ -1,6 +1,6 @@ local lush = require "lush" local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("tokyobones.palette")[bg] local specs = generator.generate(p, bg, generator.get_global_config("tokyobones", bg)) diff --git a/lua/zenbones/init.lua b/lua/zenbones/init.lua index fb12a3e..7c0fd4e 100644 --- a/lua/zenbones/init.lua +++ b/lua/zenbones/init.lua @@ -1,5 +1,5 @@ local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("zenbones.palette")[bg] return generator.generate(p, bg, generator.get_global_config("zenbones", bg)) diff --git a/lua/zenbones/shipwright/init.lua b/lua/zenbones/shipwright/init.lua index 68329d4..534a2b6 100644 --- a/lua/zenbones/shipwright/init.lua +++ b/lua/zenbones/shipwright/init.lua @@ -1,7 +1,7 @@ local M = {} local function make_specs(specs_name, ness) - local background = vim.opt.background:get() + local background = vim.o.background package.loaded[specs_name] = nil if ness == nil then return require(specs_name) @@ -26,7 +26,7 @@ local function make_env(colorscheme) transform = require "zenbones.shipwright.transform", } - vim.opt.background = colorscheme.background + vim.o.background = colorscheme.background env.specs = make_specs(specs_name) local ness = colorscheme.background == "light" and { "dim", "bright" } or { "stark", "warm" } env["specs_" .. ness[1]] = make_specs(specs_name, ness[1]) diff --git a/lua/zenbones/shipwright/runners/vim.lua b/lua/zenbones/shipwright/runners/vim.lua index fdc393b..ddc9170 100644 --- a/lua/zenbones/shipwright/runners/vim.lua +++ b/lua/zenbones/shipwright/runners/vim.lua @@ -1,11 +1,7 @@ local function to_vim_autoload(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_1 = '%s'", term.red), string.format("let g:terminal_color_2 = '%s'", term.green), @@ -43,8 +39,15 @@ run( specs, lushwright.to_vimscript, lushwright.vim_compatible_vimscript, - function(vimcolors) - return { vimcolors, term } + function(colors) + -- filter out treesitter + local vimcolors = vim.tbl_filter(function(color) + return not string.match(color, "@") + end, colors) + return { + vimcolors, + term, + } end, to_vim_autoload, { prepend, [[" This codeblock is auto-generated by shipwright.nvim]] }, @@ -62,7 +65,7 @@ run( local function remove_italics(specs) local italic_specs = {} 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)) end end diff --git a/lua/zenbones/specs/dark.lua b/lua/zenbones/specs/dark.lua index ff4560b..d0a85eb 100644 --- a/lua/zenbones/specs/dark.lua +++ b/lua/zenbones/specs/dark.lua @@ -23,20 +23,11 @@ local function generate(p, opt) ---@diagnostic disable: undefined-global -- selene: allow(undefined_variable) -- 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 { - -- 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 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 }, 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. - -- 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. + -- Tree-sitter + sym "@annotation" { PreProc }, + sym "@attribute" { PreProc }, + sym "@boolean" { Number }, + 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. - -- TSAttribute { }; -- (unstable) TODO: docs - -- TSBoolean { }; -- For booleans. - -- TSCharacter { }; -- For characters. - -- TSComment { }; -- For comment blocks. - -- TSConstructor { }; -- For constructor calls and definitions: ` { }` in Lua, and Java constructors. - -- TSConditional { }; -- For keywords related to conditionnals. - 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 }, + sym "@punctuation.special.markdown" { Special }, + sym "@string.escape.markdown" { SpecialKey }, + sym "@text.reference.markdown" { Identifier, gui = "underline" }, + sym "@text.emphasis.markdown" { Italic }, + sym "@text.title.markdown" { Statement }, + sym "@text.literal.markdown" { Type }, + sym "@text.uri.markdown" { SpecialComment }, -- Syntax diffAdded { fg = p.leaf }, @@ -277,9 +277,9 @@ local function generate(p, opt) gitcommitOverflow { WarningMsg }, - markdownUrl { markdownTSURI }, - markdownCode { markdownTSLiteral }, - markdownLinkText { markdownTSTextReference }, + markdownUrl { SpecialComment }, + markdownCode { Type }, + markdownLinkText { Identifier, gui = "underline" }, markdownLinkTextDelimiter { Delimiter }, helpHyperTextEntry { Special }, diff --git a/lua/zenbones/specs/light.lua b/lua/zenbones/specs/light.lua index 4743d4d..ee44591 100644 --- a/lua/zenbones/specs/light.lua +++ b/lua/zenbones/specs/light.lua @@ -1,6 +1,5 @@ local lush = require "lush" - local function generate(p, opt) local p1 = { bg = p.bg, @@ -24,20 +23,11 @@ local function generate(p, opt) ---@diagnostic disable: undefined-global -- selene: allow(undefined_variable) -- 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 { - -- 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 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 }, 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. - -- 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. + -- Tree-sitter + sym "@annotation" { PreProc }, + sym "@attribute" { PreProc }, + sym "@boolean" { Number }, + 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. - -- TSAttribute { }; -- (unstable) TODO: docs - -- TSBoolean { }; -- For booleans. - -- TSCharacter { }; -- For characters. - -- TSComment { }; -- For comment blocks. - -- TSConstructor { }; -- For constructor calls and definitions: ` { }` in Lua, and Java constructors. - -- TSConditional { }; -- For keywords related to conditionnals. - 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 }, + sym "@punctuation.special.markdown" { Special }, + sym "@string.escape.markdown" { SpecialKey }, + sym "@text.reference.markdown" { Identifier, gui = "underline" }, + sym "@text.emphasis.markdown" { Italic }, + sym "@text.title.markdown" { Statement }, + sym "@text.literal.markdown" { Type }, + sym "@text.uri.markdown" { SpecialComment }, -- Syntax diffAdded { fg = p.leaf }, @@ -278,9 +277,9 @@ local function generate(p, opt) gitcommitOverflow { WarningMsg }, - markdownUrl { markdownTSURI }, - markdownCode { markdownTSLiteral }, - markdownLinkText { markdownTSTextReference }, + markdownUrl { SpecialComment }, + markdownCode { Type }, + markdownLinkText { Identifier, gui = "underline" }, markdownLinkTextDelimiter { Delimiter }, helpHyperTextEntry { Special }, diff --git a/lua/zenbones/util.lua b/lua/zenbones/util.lua index c68155c..49e886c 100644 --- a/lua/zenbones/util.lua +++ b/lua/zenbones/util.lua @@ -6,12 +6,15 @@ function M.apply_colorscheme() local colors_name = vim.g.colors_name package.loaded[colors_name] = nil 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) end function M.get_colorscheme_list() 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" file:close() return vim.json.decode(content) @@ -40,7 +43,7 @@ function M.get_lualine_theme(name) if colorscheme.background then return require(string.format("lualine.themes.%s_%s", name, ness)) 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 diff --git a/lua/zenwritten/init.lua b/lua/zenwritten/init.lua index d0fcd13..9bf5a21 100644 --- a/lua/zenwritten/init.lua +++ b/lua/zenwritten/init.lua @@ -1,5 +1,5 @@ local generator = require "zenbones.specs" -local bg = vim.opt.background:get() +local bg = vim.o.background local p = require("zenwritten.palette")[bg] return generator.generate(p, bg, generator.get_global_config("zenwritten", bg))